WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Buffers running out of space

Open arichtman-srt opened this issue 3 years ago • 11 comments

Version

Microsoft Windows [Version 10.0.19044.2546]

WSL Version

  • [X] WSL 2
  • [ ] WSL 1

Kernel Version

Linux version 5.15.79.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Wed Nov 23 01:01:46 UTC 2022

Distro Version

NixOS-23.05.20230207.7479275

Other Software

$ code --version
1.75.1
441438abd1ac652551dbe4d408dfcec8a499b8bf
x64

Repro Steps

  1. Start WSL terminal
  2. Start VSCode with WSL as remote
  3. Edit files, commit and push stuff. Working normally.

Expected Behavior

  1. Try to open new tab or VSCode remote connection
  2. Connection opens without error

Actual Behavior

PS C:\Users\ariel.richtman> wsl
An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.
Error code: Wsl/Service/0x80072747

Diagnostic Logs

WslLogs-2023-02-15_13-04-55.zip

arichtman-srt avatar Feb 15 '23 03:02 arichtman-srt

If resource limits are being exceeded you'll get this kind of error messages. Is your system running out of memory?

zcobol avatar Feb 15 '23 05:02 zcobol

Not that I saw, it was idling at ~20/32 GiB. CPU was similarly low with no spikes. It's a laptop i7 if that helps. That said it could be the VM it's running on not getting enough share of non-compressible resources.

arichtman-srt avatar Feb 15 '23 05:02 arichtman-srt

Also getting this after using Jetbrains IDEs to connect to WSL, no abnormal resource usage, but WSL memory usage is quite high at 8GB when the issue happens.

ashermiddleton avatar Jun 09 '23 03:06 ashermiddleton

For what it's worth I stopped using VSCode and haven't had the issue reoccur.

arichtman-srt avatar Jun 09 '23 03:06 arichtman-srt

I'm at 52% of my ram which totals 32GB and I keep getting this error. Not sure if related but did a windows update recently-ish and updated PHPStorm.

There is free space on my hard drives

Could it be related to too many files in /var/run/WSL ? 395 files in this directory.

 sudo ls -alh /var/run/WSL | wc
    395    3548   21510

I do notice there seem to be a lot of wslhost.exe's running not sure if its normal.

wsl --update Checking for updates. The most recent version of Windows Subsystem for Linux is already installed.

LiamKarlMitchell avatar Aug 12 '23 04:08 LiamKarlMitchell

I've had the exact same issue when using PhpStorm (link to issue raised on Jetbrains issue tracker here).

For me, this issue only occurs when trying to use the git executable inside of the WSL filesystem from PhpStorm. If I use a git.exe within the Windows filesystem, this issue does not occur.

stu177 avatar Aug 19 '23 22:08 stu177

Ah, right, so I did have some ssh-agent stuff in my ~/.bash_profile for some reason.

I also had a cd in here.

After updating phpstorm recently, it had stopped working with git due to ssh-agent outputing some numbers into stdout. Making it output to dev/null fixed that, but then it still couldn't work with git commands due to the cd, like it was using relative paths not absolute.

# Run ssh-agent silently.
#eval $(ssh-agent > /dev/null);
#ssh-add > /dev/null 2>&1

So every time PHP Storm goes to do something with git or running tests I'm thinking it makes a new connection. And there has been a long standing bug where it does not remove previous /var/run/WSL handles/sockets?

So thats why I wondered if it was the problem.

Removing the ssh-agent for now in my bash profile has seemed to reduce the issue, but it could have just been rebooting my pc.

LiamKarlMitchell avatar Aug 19 '23 22:08 LiamKarlMitchell

Ah good find, I think that's sorted my issue as I had a similar thing in my .profile to run ssh-agent. We used it for adding the current ssh-agent into an environment variable for use within docker containers but can do it manually if it prevents this issue.

stu177 avatar Aug 23 '23 10:08 stu177

So ssh-agent sets some environment variables and runs in the background. I suspect we can extract the details that would be evaulated into a temporary sh file in /tmp.

Then if file exists, and process id of ssh-agent in background? is same/existing we don't need to re-run ssh-agent but can just eval the values in new shell login.

Then it shouldn't be a problem right? :)

But it does make me wonder why wsl couldn't just run the ssh-agent once and apply the value to all shells? Does it have to be separate per linux user? Does it normally run under systemd or some initscript in normal linuxs?

LiamKarlMitchell avatar Aug 23 '23 12:08 LiamKarlMitchell

I suspect the PhpStorm sessions are non-interactive but opened with --login as my ~/.profile is still executed and has similar commands to load the SSH agent; so I just tested for interactivity and it greatly reduced the number of WSL handles opened by ssh-agent:

if test "$PS1"; then
    eval `ssh-agent -s`
    ssh-add ~/.ssh/id_rsa
fi

Hope this helps!

webgraphe avatar Aug 25 '23 14:08 webgraphe

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!