Skip to content

[Consomme] Concurrent bind()/listen() stalls the port tracker; every bind() then takes ~1 s and WSL eventually hangs (ERROR_TIMEOUT) #42372

Backlog

Description

Windows Version

Microsoft Windows [Version 10.0.26300.10075]

WSL Version

3.0.5.0

Are you using WSL 1, WSL 2, or WSLC?

  • WSL 2
  • WSL 1
  • WSLC

Kernel Version

6.18.58.1-microsoft-standard-WSL2 (stock). Also reproduces on a custom build of the same version.

Distro Version

Ubuntu 26.04.1 LTS, systemd enabled

Other Software

Python 3.14.4 in the distro (stdlib only). Host: 28 logical CPUs, 64 GB RAM.

.wslconfig during the repro:

[wsl2]
processors=18
memory=40GB
swap=24GB
networkingMode=Consomme
vmIdleTimeout=999999999

[general]
instanceIdleTimeout=999999999

[experimental]
autoMemoryReclaim=Gradual

I have not tried a config with only networkingMode=Consomme.

Repro Steps

  1. Set networkingMode=Consomme, run wsl --shutdown, start the distro, and confirm with wslinfo --networking-mode.
  2. Save single_bind.py:
import socket, time
start = time.monotonic()
with socket.socket() as s:
    s.bind(("0.0.0.0", 0))
    s.listen(1)
print(f"bind+listen took {time.monotonic() - start:.3f}s")
  1. Save bind_stress.py. It runs 64 threads × 500 ephemeral-port bind+listen calls, alternating IPv4 and IPv6, which is roughly what a parallel build or test run does:
import socket, time
from concurrent.futures import ThreadPoolExecutor

def worker(_):
    ok = err = 0
    for i in range(500):
        fam = socket.AF_INET6 if i % 2 else socket.AF_INET
        host = "::" if i % 2 else "0.0.0.0"
        with socket.socket(fam, socket.SOCK_STREAM) as s:
            try:
                s.bind((host, 0)); s.listen(1); ok += 1
            except OSError:
                err += 1
    return ok, err

start = time.monotonic()
with ThreadPoolExecutor(64) as pool:
    r = list(pool.map(worker, range(64)))
print(f"ok={sum(x[0] for x in r)} errors={sum(x[1] for x in r)} in {time.monotonic() - start:.1f}s")
  1. Run:
python3 single_bind.py
timeout 90 python3 bind_stress.py
python3 single_bind.py
  1. Repeat with networkingMode=nat for comparison.

Expected Behavior

bind() and listen() return promptly regardless of load, as they do under NAT. Same machine, same distro, stock kernel, NAT:

baseline: bind+listen took 0.000s
round 1..5: ok=32000 errors=0 in 8.5-8.7s each (160,000 calls total)
after:    bind+listen took 0.000s

Actual Behavior

Under Consomme, starting from a fresh wsl --shutdown, with the stock kernel:

baseline: bind+listen took 0.015s
burst:    stalled, killed by timeout after 90s
after:    bind+listen took 0.989s

The damage persists after the load stops. 15 minutes later a single bind() still took 0.998s, and it stays that way until the WSL service is restarted.

In real use (parallel builds), WSL runs normally for 30 minutes or more after a Windows boot, then:

  • commands in an open shell stop returning;
  • new wsl.exe invocations hang;
  • wsl --shutdown runs for minutes without returning;
  • eventually the terminal closes with:
This operation returned because the timeout period expired.
Error code: Wsl/Service/ERROR_TIMEOUT
[process exited with code 4294967295 (0xffffffff)]

(translated from a pt-BR system), after which WSL does not start again until Windows reboots. Force-stopping wslservice.exe and vmwp.exe from an elevated shell recovers it without a reboot.

What the guest shows during the full hang. wsl --debug-shell still responds, so I collected this there:

  • The guest kernel is healthy: SysRq w lists no blocked tasks, memory and IO pressure are 0, swap is unused, and vmmemWSL is idle.
  • The distro's init-systemd(Ubuntu) (the WSL init that launches new sessions), systemd --user and systemd-udevd are all parked in seccomp_do_user_notification on syscall 49 (bind).
  • The process holding the anon_inode:seccomp listener fd is localhost --port-tracker-fd 8 --bpf-fd 10 --netlink-fd 9 --localhost-relay -1 --networking-mode 4. Its main thread waits in vsock_connectible_wait_data (recvfrom), and its SecCompDispatch and GnsPortTracker threads are in futex_do_wait. It appears to be waiting for a host reply that never arrives.
  • During the synthetic repro, all 64 stress threads were in seccomp_do_user_notification on bind (49) or listen (50). They survived SIGTERM from timeout and only went away with SIGKILL.

At about 1 s per intercepted bind(), a workload that binds thousands of sockets, or several processes binding concurrently, stalls for hours. The WSL init's own bind() goes through the same interception, which would explain why new sessions and wsl --shutdown hang too. In the synthetic repro, with no other binds queued, wsl --shutdown still returned (6.7 s). While the stress test ran, the host's wslservice.exe handle and thread counts did not grow (588 handles, 15 threads), and no host TCP/UDP endpoints were owned by WSL processes.

Under Consomme the stress test also hits EADDRINUSE on listen() for ephemeral ports before it stalls, which looks like #42352.

Workaround: networkingMode=nat.

Diagnostic Logs

None attached. I can collect collect-wsl-logs.ps1 -LogProfile networking during a hang if the team needs them.

Activity

  1. github-actions commented on Nov 26, 2026

    @github-actions
    Contributor

    Logs are required for review from WSL team

    If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
    Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

    How to collect WSL logs

    Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

    Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
    Set-ExecutionPolicy Bypass -Scope Process -Force
    .\collect-wsl-logs.ps1
    

    The script will output the path of the log file once done.

    If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues

    Once completed please upload the output files to this GitHub issue.

    See Collect WSL logs (recommended method).

    If you choose to email these logs instead of attaching them to the bug, please send them to wsl-gh-logs@microsoft.com with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

  2. juliopolycarpo commented on Nov 27, 2026

    @juliopolycarpo
    Author

    /emailed-logs

    I sent the logs to wsl-gh-logs@microsoft.com with the subject "Logs for #42372". They come from collect-wsl-logs.ps1 (default profile) under networkingMode=Consomme, captured during the repro above: 5 bursts of 64 threads × 500 bind+listen calls.

    From the trace:

    • The host mapped ports at a steady ~100 per second for the whole run, so no 32,000-call burst could finish within its 90 s timeout.
    • 836 host-side bind() calls failed in Consomme: 824 with WSAEACCES (10013) and 12 with WSAEADDRINUSE (10048). A 10013 from bind() on Windows usually means the port is in an excluded port range; I haven't matched the failing ports against netsh int ipv4 show excludedportrange.

    The capture shows only the slow path. The full hang, where the port tracker stops answering and wsl --shutdown never returns, did not occur during it. I can capture that state on request.

  3. github-actions commented on Nov 27, 2026

    @github-actions
    Contributor
    Diagnostic information
    Found '/emailed-logs', adding tag 'emailed-logs'
    
  4. added
    emailed-logs
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    emailed-logs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions