npiperelay icon indicating copy to clipboard operation
npiperelay copied to clipboard

Hangs under WSL2

Open Kalamatee opened this issue 5 years ago • 5 comments

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?

Kalamatee avatar Dec 17 '20 02:12 Kalamatee

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?

RomanDanyk avatar Dec 05 '21 09:12 RomanDanyk

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.

ktetzlaff avatar Dec 06 '21 11:12 ktetzlaff

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?

stuartleeks avatar Dec 06 '21 12:12 stuartleeks

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.

ktetzlaff avatar Dec 06 '21 12:12 ktetzlaff

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>

rda0 avatar Apr 05 '24 15:04 rda0