edge preflight: lsof fallback matches OUTBOUND connections, falsely reports port 443 as occupied
Bug
openship server install -c openresty aborts with:
openresty failed: Ports 443 are in use by another service (unknown). Accept a migrate or takeover to continue.
even though nothing listens on 443 on the server.
Root cause
In probeListeningPort the port probe is:
ss -tlnp sport = :443 2>/dev/null | grep LISTEN || lsof -ti tcp:443 2>/dev/null || true
When ss finds no listener (grep exits 1), the lsof fallback runs without a LISTEN filter, so it matches any socket that touches port 443 — including outbound connections server -> remote:443. The PID of a process that merely makes HTTPS requests is then treated as the port-443 "occupant", classified as unknown, and the edge preflight raises EdgeConflictError.
Reproduced on a server running a gateway daemon with persistent outbound connections to 149.154.166.110:443 (Telegram): lsof -ti tcp:443 returns that daemon's PID while ss -tlnp sport = :443 is empty. Servers without such outbound connections install fine — which makes the failure look flaky/machine-dependent.
Fix
Add the LISTEN state filter to the fallback:
lsof -ti tcp:${port} -sTCP:LISTEN
Verified locally: patching this one line in dist/server/index.js makes server install -c openresty succeed on the affected machines, and the resulting openresty passes server check as healthy.
Environment
- CLI v0.2.1 (npm), desktop app v0.2.1, macOS arm64
- Target: Ubuntu 24.04
fixed, thank oyu
we love your edge cases feedback, that's amazing keep going thank you, also pr is appreciated any time