jstarks / npiperelay

npiperelay allows you to access Windows named pipes from WSL
MIT License
660 stars 71 forks source link

Hangs under WSL2 #19

Open Kalamatee opened 3 years ago

Kalamatee commented 3 years ago

Im trying to connect the serial port as described in the instructions, but when the script is run, it just hangs and goes no further?

RomanDanyk commented 2 years ago

Sometimes I experience a similar issue. I use the npiperelay tool to communicate SSH agents in Windows and WSL2. Usually, it works great, but sometimes SSH commands in WSL2 hang. I'm not sure the npiperelay tool is a genuine reason for this problem, though. Is there a way to debug such an issue?

ktetzlaff commented 2 years ago

I have the same problem as @RomanDanyk. Using npiperelay to communicate from WSL2 with windows native ssh-agent works fine for weeks and then suddenly stops working. All ssh commands in WSL2 just hang forever. I already tried:

  1. restart socat/npiperelay in WSL2
  2. restarting ssh-agent on Windows side
  3. restart WSL2 (wsl -shutdown)

But so far, no success. A reboot fixes the issue, but that seems like overkill. Any ideas on how to debug or fix the issue would be great.

stuartleeks commented 2 years ago

I've been hitting similar issues with git commands hanging as I use SSH key auth and forward key requests to the Windows SSH Agent with npiperelay.

What I noticed is that when this stops working for me, it seems like the WSL -> Windows interop is broken. E.g. running notepad.exe from a shell in the WSL distro also fails. I created an issue in the WSL repo, so it might be worth upvoting that if you're hitting the same issue?

ktetzlaff commented 2 years ago

I can confirm the observation of @stuartleeks: starting any (even console executable) windows program from WSL2 just fails. The terminal blocks forever (Ctrl-C doesn't work) - the w32 executable has to be killed from a second terminal.

So the problem doesn't seem to be a npiperelay issue. Still, it might make sense to keep this issue around as a pointer to the WSL2 issue.

rda0 commented 5 months ago

I use npiperelay to conenct the SSH_AUTH_SOCK to the ssh-agent running on Windows. Very recently my ssh connections (logins) started to be very slow (6s), hanging at:

debug1: rekey in after 134217728 blocks
🦗 6s
debug1: get_agent_identities: agent returned 2 keys

Also ssh-add -l in WSL hangs for the same amount of time, as well as:

$ time npiperelay.exe --help
Usage of npiperelay.exe:
...
real    0m5.256s

It was caused by Windows Defender Real-time protection. I was able to resolve it by adding an exclude for the directory where npiperelay.exe is located, like that:

\\wsl.localhost\<dist>\<npiperelay_directory>