#1232·rod

LockPort hangs forever when port binding is denied (no timeout/error)

Author: machenfei01Created Apr 24, 2026Updated Sep 8, 2026

Rod Version: v0.116.2

Problem:

LockPort() uses an infinite loop to bind 127.0.0.1:2978. In container environments where port binding is restricted (e.g., hostNetwork with dynamic port allocation), net.Listen always returns Permission denied, causing a silent infinite hang — no timeout, no error, no log.

// leakless.go:141 func LockPort(port int) func() { for { l, err = net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port)) if err == nil { break } time.Sleep(...) // retries forever, never returns error } } Impact:

Caller hangs permanently with no indication of failure GetLeaklessBin() is never reached, guardian binary is never extracted Users see a frozen process with no error message Environment:

Kubernetes with hostNetwork + dynamic port allocation (only platform-assigned ports can be bound) net.Listen("127.0.0.1", 2978) → PermissionError: [Errno 13] Permission denied Suggestion:

Add a max retry count or timeout, return an error instead of hanging Consider using file locks (flock) as a fallback Or make the lock mechanism configurable/optional