When you run nc -l 5432 on the dev-database port:
$ lsof -nP -i :5432 | grep LISTEN
nc 67588 ilakovac 3u IPv4 0x2b284e848f681f22 0t0 TCP *:5432 (LISTEN)
nc 69683 ilakovac 3u IPv4 0x8350f3e3a67bb38f 0t0 TCP *:5432 (LISTEN)
wasp doctor claims the port is free:
$ wasp doctor
[✓] Dev database port (5432): free
and starting the dev database dies with a raw runtime error instead of the intended friendly message:
$ wasp start db
wasp-cli: Network.Socket.connect: <socket: 147>: timeout (Operation timed out)
HasCallStack backtrace:
bracket, called at lib/System/IO/Utf8.hs:154:24 in wth-tf8-1.1.0.0-1dd5724a:System.IO.Utf8
exit=1
Cause: two stacked probe flaws around port 5432:
- Doctor's only probe is
checkIfPortIsInUse (src/Wasp/Util/Network/Socket.hs:37), which binds 127.0.0.1:PORT with SO_REUSEADDR set - that succeeds under a wildcard (*:5432) listener, so the port reads as free. start db knows about this hole and adds a second probe (checkIfPortIsAcceptingConnections, comment at cli/src/Wasp/Cli/Command/Start/Db.hs:146)...
- ...but that probe connects, and any exception other than
ECONNREFUSED is rethrown (Socket.hs:24). Against nc -l the connect times out; the resulting IOException escapes both the requirement wrapper and Main.hs's ErrorCall-only handler, producing the crash above. The clean [Error] Port already in use path only triggers for ports that refuse connections outright.
When you run
nc -l 5432on the dev-database port:wasp doctorclaims the port is free:and starting the dev database dies with a raw runtime error instead of the intended friendly message:
Cause: two stacked probe flaws around port 5432:
checkIfPortIsInUse(src/Wasp/Util/Network/Socket.hs:37), which binds127.0.0.1:PORTwithSO_REUSEADDRset - that succeeds under a wildcard (*:5432) listener, so the port reads as free.start dbknows about this hole and adds a second probe (checkIfPortIsAcceptingConnections, comment atcli/src/Wasp/Cli/Command/Start/Db.hs:146)...ECONNREFUSEDis rethrown (Socket.hs:24). Againstnc -lthe connect times out; the resultingIOExceptionescapes both the requirement wrapper andMain.hs'sErrorCall-only handler, producing the crash above. The clean[Error] Port already in usepath only triggers for ports that refuse connections outright.