Files
Codeman/.changeset/start-codeman-port-probe.md
T
Aamer Akhter 0e913eedf2 fix(docker): bound Start-Codeman.sh's port probe to about a second
port_in_use() connected with bash's /dev/tcp and waited for the answer.
A listening port answers at once and a closed one is normally refused
at once, but on WSL a connect to a closed 127.0.0.1 port is dropped
and only fails at the kernel's connect timeout, minutes later
(measured: still waiting after 10 s; ::1 is refused at once). The
first-run port search tries up to 100 ports from 3000 and the start
path checks the chosen port again, so a first run on WSL stalled.

Each connect now runs in a background subshell that port_answers()
waits on for at most 20 x 50 ms, then kills; no answer in time reads
as free. Bash 3.2 clean: no `timeout` (macOS ships none), no `wait -n`.

Test: a python3 listener with a full accept queue (Linux drops further
SYNs, the same no-answer a WSL closed port gives) must be given up on
within 3 s; a listening port and a closed one still answer at once.
With the old unbounded connect the first test fails at its 10 s cap.
2026-11-15 15:09:20 -05:00

6 lines
429 B
Markdown

---
'aicodeman': patch
---
`docker/Start-Codeman.sh` no longer hangs on WSL while it looks for a free port. On WSL a connect to a closed 127.0.0.1 port is dropped rather than refused and only fails at the kernel's connect timeout, so the first-run port search (up to 100 ports) and the check before `docker compose up` could stall for many minutes. Each port check now gives up after about a second and reads no answer as free.