Repository navigation
fix: add timeout to IsPortActive to prevent macOS hangs - #8147
Merged
Merged
Conversation
|
Download the artifacts for this pull request:
See Testing a PR. |
rfay
commented
Feb 16, 2026
Comment on lines
21
to
23
| if nodeps.IsWSL2() { | ||
| dialTimeout = 200 * time.Millisecond | ||
| } |
Member
Author
There was a problem hiding this comment.
I imagine we should just remove the WSL2 stanza.
Member
There was a problem hiding this comment.
I wonder if 200ms could be used everywhere to make the process faster.
1 second is enough, but if it could get stuck for every port, then it will be noticeable.
IsPortActive used a zero timeout (no deadline) for net.DialTimeout on non-WSL2 platforms. On macOS with VM-based Docker providers (Lima, OrbStack, Rancher Desktop), ports can be in a state where the TCP SYN gets no response, causing the connect to hang indefinitely. This was triggered by the Go 1.25->1.26 upgrade on CI machines. A 1-second timeout is generous for localhost port checks (active ports respond in <1ms) while preventing indefinite hangs. Co-Authored-By: Claude Opus 4.6 <[email protected]>
rfay
force-pushed
the
20260215_rfay_macos_hang
branch
from
February 16, 2026 21:36
105492c to
f2364ab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Issue
macOS CI tests (Lima, Rancher Desktop, and potentially OrbStack) hang indefinitely during
ddev startin theCheckRouterPorts→IsPortActivecode path. The hang occurs innet.DialTimeout("tcp", "127.0.0.1:PORT", 0)where the zero timeout means no deadline at all.On macOS with VM-based Docker providers, ports can be in a state where the TCP SYN gets no response (neither RST nor SYN-ACK) — likely due to the port forwarding layer (Lima hostagent, etc.) having a port bound but not actively responding. With no timeout, the TCP connect retries indefinitely.
Goroutine dumps from two separate CI machines (Lima and Rancher Desktop) confirmed the identical hang:
This latent bug was likely triggered by the Go 1.25 → 1.26 upgrade on CI machines, which may have changed internal TCP connect behavior in the
netpackage (Go 1.26 added newDialer.DialTCP/DialIPmethods, suggesting internal dial path refactoring).How This PR Solves The Issue
Changes
dialTimeoutdefault from0(infinite) to1 * time.SecondinIsPortActive. This is generous for a localhost port check — active ports respond in <1ms — while preventing indefinite hangs when ports are unresponsive.The existing WSL2 case keeps its 200ms timeout, which was already tuned for its specific mirrored networking behavior.
Manual Testing Instructions
ddev starton macOS with any VM-based Docker provider (Lima, Colima, OrbStack, Rancher Desktop)ddev start— it should report the conflict within ~1 secondAutomated Testing Overview
No new tests needed.
IsPortActiveis exercised by existing integration tests (TestRouterPortsinrouter_test.go). The fix changes a timeout value, not logic — active ports still respond in <1ms, and the 1s timeout only affects the failure/hang case which was previously infinite.Release/Deployment Notes
This is a one-line change with no behavioral impact for normal operation. Port checks that previously returned instantly will continue to do so. The only difference is that unresponsive ports now timeout after 1 second instead of hanging indefinitely.
PR #8146 (revert of #8128) can be closed — the port check skip for remote Docker hosts was not the cause of the hangs.