-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mirrored mode keep-alive not working #10741
Comments
Could you please follow the steps below and attach the diagnostic logs? https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues |
Hi @dorssel . In your repro, I'm seeing the following TCP connections to a loopback listener on the host listening on 127.0.0.1:3240. Can you please show what connections are problematic in-to/out-of the Linux container? the first connection is just a quick connect/closesocket: 1 16:57:41.300047 loopback0 Out IP 127.0.0.1.60766 > 127.0.0.1.3240: Flags [S], seq 802777829, win 64240, options [mss 1460,sackOK,TS val 2727195490 ecr 0,nop,wscale 7], length 0 The second connection shows a successful TCP connection established, data was pushed and ACKd, then the connection was terminated (this Linux client RST/terminated this connection). The local port for this connection is 60768: 8 16:57:41.495899 loopback0 Out IP 127.0.0.1.60768 > 127.0.0.1.3240: Flags [S], seq 124944460, win 64240, options [mss 1460,sackOK,TS val 2727195685 ecr 0,nop,wscale 7], length 0 The third connection shows a stale connection where the Linux client is not correctly processing the RST from the target, and it keeps trying to ack. 57 16:57:53.465887 loopback0 In IP 127.0.0.1.3240 > 127.0.0.1.43959: Flags [.], seq 2213421088:2213421089, ack 124945029, win 8193, length 1 |
The second connection is problematic. Maybe I can explain how you can reproduce this with minimal effort:
Expected result:
Actual result:
Root cause: the actual keep-alive packet is malformed. |
Windows Version
Microsoft Windows [Version 10.0.22631.2506]
WSL Version
2.0.9.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.133.1-1
Distro Version
Ubuntu 22.04.3 LTS
Other Software
usbipd-win 3.2.0
Repro Steps
Attach a USB device with
usbipd-win
, and let the device be idle (no actual USB traffic).After attaching a USB device that is otherwise idle, the connection gets closed after 20 seconds. This is exactly the total keep-alive timeout (including retries) that should keep the connection alive.
NOTE: This will happen for any socket that enables keep-alive on the Windows (host) side. Only for mirrored mode with connections to 127.0.0.1 (WSL to host over loopback0).
Expected Behavior
The keep-alive should work normally and the connection should not be dropped.
Actual Behavior
The connection gets closed after 20 seconds. This is exactly the total keep-alive timeout (including retries) that should keep the connection alive.
NOTE: This will happen for any socket that enables keep-alive on the Windows (host) side. It is not USBIP related per se, but that is the software that displays this behavior. Only for mirrored mode with connections to 127.0.0.1 (WSL to host over loopback0).
Diagnostic Logs
For a working setup (not mirror mode), a
tcpdump -i eth0 "port 3240"
shows correct behavior:Analysis: every 10 seconds a new keep-alive is sent, which is properly replied to (ACK).
For the bug (mirror mode, connection to 127.0.0.1), a
tcpdump -i loopback0 "port 3240"
shows:Analysis:
This may actually be 2 bugs: a) the keep-alive packet is wrong and b) once the socket is doing keep-alives (or so it thinks), it actually no longer honors connection resets until all keep-alives are sent.
Note that this is completely outside the control of any software; this is all kernel. The bug exists in the mirror socket on the Windows side.
The text was updated successfully, but these errors were encountered: