Repository navigation
Conversation
The ddev-windows-mutagen pipeline has hung 3 times in the last 30 hours (builds 6413, 6418, 6419), each time hitting the global 6h go test timeout and burning the full 6h15m-6h22m before failing. Normal passing runs finish in ~160-220m, so 6h is far more slack than needed and turns every hang into a multi-hour stall of the (mostly single) Windows runner. Thread TEST_TIMEOUT through test.sh's make invocation and override it to 4h for this pipeline only, leaving the 6h default untouched for every other CI job that uses the same script. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Update: reproduced live a 4th time, plus new evidence pointing at Docker Desktop itselfWhile this PR was open, New corroborating evidence found today:
Checked for a ddev-side regression: reviewed |
|
It's hung again on upstream/main https://buildkite.com/ddev/ddev-windows-mutagen/builds/6419#019fba98-533f-4022-b8e7-1afd1e4f15eb After that one times out this PR will get a chance at it. It will be interesting to see if it's exactly the same. |
|
Next steps on this:
|
|
TestRouterNotRebuiltOnHostnameChange failed on OrbStack, |
|
I don't think this is a useful approach. |
#8644 ## The Issue - Fixes #8644 `ddev-windows-mutagen` hung for the full 6h `go test -timeout` in three consecutive runs (6418, 6419, 6421), always inside `TestRouterNotRebuiltOnHostnameChange`, blocked writing a debug log line to stdout. #8644 mitigated the symptom by capping the pipeline's timeout at 4h, attributing the hangs to a Docker Desktop 4.84.0 backend regression on the Windows runner (cross-referencing docker/desktop-feedback#560). The test wraps `app2.Start()`/`app2.Restart()` in `util.CaptureUserOut()`. That helper redirects output to an `os.Pipe()` that isn't drained until `getOutput()` is called - i.e. only after `Start()`/`Restart()` returns. With `DDEV_DEBUG=true` (set for all CI runs), a full `app.Start()` can emit enough debug output to fill that pipe before it returns, deadlocking the write. This is a known, longstanding Windows limitation of `CaptureUserOut()`: `TestDdevLogs` has skipped Windows for the identical reason since 2018. `TestRouterNotRebuiltOnHostnameChange` (added in 6e7e416, merged 2026-07-30) just reintroduced the same hazard without a Windows guard. ## How This PR Solves The Issue - `pkg/ddevapp/router_test.go`: skip `TestRouterNotRebuiltOnHostnameChange` on Windows, following the same pattern (and referencing the same root cause) as the existing `TestDdevLogs` Windows skip. ## Manual Testing Instructions 1. On Windows, run `go test -v -run TestRouterNotRebuiltOnHostnameChange ./pkg/ddevapp/...` and confirm it's skipped rather than hanging. 2. `make staticrequired` passes. ## Automated Testing Overview No new tests added; `TestRouterNotRebuiltOnHostnameChange` is now skipped on Windows where `CaptureUserOut()` remains unsafe around a full `Start()`/`Restart()`. ## Release/Deployment Notes No user-facing behavior change; the skip only affects CI. Co-Authored-By: Claude Sonnet 5 <[email protected]>
#8644 (#8649) [skip ci] Co-authored-by: Claude Sonnet 5 <[email protected]>
…ontainer, for ddev#8644 ## The Issue - For ddev#8644 When a standard router port (say 443) is busy at router creation time, the router is created bound to an ephemeral substitute (say 33000). The router binds substitutes as `33000:33000`, so the container carries no trace of which standard port the ephemeral port stands in for. If the original occupant of 443 then goes away, a later `ddev start` of another project sees 443 as free and expects the router to bind it directly - a port the running router does not have - so `PortsMatch()` fails and the router is recreated unnecessarily. That recreation churn is what made `TestRouterNotRebuiltOnHostnameChange` fail on macos-orbstack and exposed the CaptureUserOut() hang on Windows. ## How This PR Solves The Issue Record the substitution decision on the object whose lifetime bounds its validity: the router container itself. - `generateRouterCompose()` writes a `com.ddev.router-port-substitutions` Docker label (e.g. `443=33000`) onto the router, merging the previous router's label with substitutions decided by the current process and dropping entries whose ephemeral port the new router no longer binds. - `GetAvailableRouterPort()` consults the label (plus the in-process map) when the proposed port looks free on the host: if the running router still has the previously-substituted ephemeral port bound, it keeps using the substitute instead of handing out the now-free standard port, avoiding the spurious recreation. Because the record lives on the container, it works across separate ddev invocations, not just within one process, and disappears naturally when the router is recreated or removed (`ddev poweroff` returns projects to their configured ports). The map is only consulted when the proposed port is free; when it is still busy, allocation goes through `AllocateAvailablePortForRouter()` as before, which honors `EphemeralRouterPortsAssigned` and gives concurrent projects distinct ephemeral ports. Also rewords the "Port X is busy" message to "Port X is not available", since with this change the substitute can be reported when the port is no longer busy, and updates the matching troubleshooting docs example. ## Manual Testing Instructions 1. Occupy ports 80/443 (or whatever your configured router ports are) with a throwaway listener. 2. `ddev start` project1; note the "Port X is not available, using Y instead" message and `docker inspect ddev-router` showing the `com.ddev.router-port-substitutions` label. 3. Kill the listener so the standard port is free again. 4. `ddev start` project2 (a separate ddev process); the router is not recreated ("ddev-router already running, pushing new config...") and project2 adopts the same substitute port. 5. `ddev poweroff && ddev start`: projects return to the standard ports. ## Automated Testing Overview - New unit tests (`TestParseFormatRouterPortSubstitutions`, `TestKnownRouterPortSubstitutions`) cover label serialization, malformed input, and label/in-process merging. - Existing `TestRouterNotRebuiltOnHostnameChange` exercises the router-recreation logic with the new label in place (passes locally). ## Release/Deployment Notes Ephemeral port substitutions become sticky for the life of the router container: once a project is substituted onto an ephemeral port, it keeps that port even after the conflicting process goes away, until the router is recreated (e.g. `ddev poweroff`). Routers created by earlier DDEV versions have no label, so the first start after upgrade behaves as before; the label appears at the next router recreation. Co-Authored-By: Claude Fable 5 <[email protected]>
…ontainer, for ddev#8644 ## The Issue - For ddev#8644 When a standard router port (say 443) is busy at router creation time, the router is created bound to an ephemeral substitute (say 33000). The router binds substitutes as `33000:33000`, so the container carries no trace of which standard port the ephemeral port stands in for. If the original occupant of 443 then goes away, a later `ddev start` of another project sees 443 as free and expects the router to bind it directly - a port the running router does not have - so `PortsMatch()` fails and the router is recreated unnecessarily. That recreation churn is what made `TestRouterNotRebuiltOnHostnameChange` fail on macos-orbstack and exposed the CaptureUserOut() hang on Windows. ## How This PR Solves The Issue Record the substitution decision on the object whose lifetime bounds its validity: the router container itself. - `generateRouterCompose()` writes a `com.ddev.router-port-substitutions` Docker label (e.g. `443=33000`) onto the router, merging the previous router's label with substitutions decided by the current process and dropping entries whose ephemeral port the new router no longer binds. - `GetAvailableRouterPort()` consults the label (plus the in-process map) when the proposed port looks free on the host: if the running router still has the previously-substituted ephemeral port bound, it keeps using the substitute instead of handing out the now-free standard port, avoiding the spurious recreation. Because the record lives on the container, it works across separate ddev invocations, not just within one process, and disappears naturally when the router is recreated or removed (`ddev poweroff` returns projects to their configured ports). The map is only consulted when the proposed port is free; when it is still busy, allocation goes through `AllocateAvailablePortForRouter()` as before, which honors `EphemeralRouterPortsAssigned` and gives concurrent projects distinct ephemeral ports. Also rewords the "Port X is busy" message to "Port X is not available", since with this change the substitute can be reported when the port is no longer busy, and updates the matching troubleshooting docs example. ## Manual Testing Instructions 1. Occupy ports 80/443 (or whatever your configured router ports are) with a throwaway listener. 2. `ddev start` project1; note the "Port X is not available, using Y instead" message and `docker inspect ddev-router` showing the `com.ddev.router-port-substitutions` label. 3. Kill the listener so the standard port is free again. 4. `ddev start` project2 (a separate ddev process); the router is not recreated ("ddev-router already running, pushing new config...") and project2 adopts the same substitute port. 5. `ddev poweroff && ddev start`: projects return to the standard ports. ## Automated Testing Overview - New unit tests (`TestParseFormatRouterPortSubstitutions`, `TestKnownRouterPortSubstitutions`) cover label serialization, malformed input, and label/in-process merging. - Existing `TestRouterNotRebuiltOnHostnameChange` exercises the router-recreation logic with the new label in place (passes locally). ## Release/Deployment Notes Ephemeral port substitutions become sticky for the life of the router container: once a project is substituted onto an ephemeral port, it keeps that port even after the conflicting process goes away, until the router is recreated (e.g. `ddev poweroff`). Routers created by earlier DDEV versions have no label, so the first start after upgrade behaves as before; the label appears at the next router recreation. Co-Authored-By: Claude Fable 5 <[email protected]>
…ontainer, for ddev#8644 ## The Issue - For ddev#8644 When a standard router port (say 443) is busy at router creation time, the router is created bound to an ephemeral substitute (say 33000). The router binds substitutes as `33000:33000`, so the container carries no trace of which standard port the ephemeral port stands in for. If the original occupant of 443 then goes away, a later `ddev start` of another project sees 443 as free and expects the router to bind it directly - a port the running router does not have - so `PortsMatch()` fails and the router is recreated unnecessarily. That recreation churn is what made `TestRouterNotRebuiltOnHostnameChange` fail on macos-orbstack and exposed the CaptureUserOut() hang on Windows. ## How This PR Solves The Issue Record the substitution decision on the object whose lifetime bounds its validity: the router container itself. - `generateRouterCompose()` writes a `com.ddev.router-port-substitutions` Docker label (e.g. `443=33000`) onto the router, merging the previous router's label with substitutions decided by the current process and dropping entries whose ephemeral port the new router no longer binds. - `GetAvailableRouterPort()` consults the label (plus the in-process map) when the proposed port looks free on the host: if the running router still has the previously-substituted ephemeral port bound, it keeps using the substitute instead of handing out the now-free standard port, avoiding the spurious recreation. Because the record lives on the container, it works across separate ddev invocations, not just within one process, and disappears naturally when the router is recreated or removed (`ddev poweroff` returns projects to their configured ports). The map is only consulted when the proposed port is free; when it is still busy, allocation goes through `AllocateAvailablePortForRouter()` as before, which honors `EphemeralRouterPortsAssigned` and gives concurrent projects distinct ephemeral ports. Also rewords the "Port X is busy" message to "Port X is not available", since with this change the substitute can be reported when the port is no longer busy, and updates the matching troubleshooting docs example. ## Manual Testing Instructions 1. Occupy ports 80/443 (or whatever your configured router ports are) with a throwaway listener. 2. `ddev start` project1; note the "Port X is not available, using Y instead" message and `docker inspect ddev-router` showing the `com.ddev.router-port-substitutions` label. 3. Kill the listener so the standard port is free again. 4. `ddev start` project2 (a separate ddev process); the router is not recreated ("ddev-router already running, pushing new config...") and project2 adopts the same substitute port. 5. `ddev poweroff && ddev start`: projects return to the standard ports. ## Automated Testing Overview - New unit tests (`TestParseFormatRouterPortSubstitutions`, `TestKnownRouterPortSubstitutions`) cover label serialization, malformed input, and label/in-process merging. - Existing `TestRouterNotRebuiltOnHostnameChange` exercises the router-recreation logic with the new label in place (passes locally). ## Release/Deployment Notes Ephemeral port substitutions become sticky for the life of the router container: once a project is substituted onto an ephemeral port, it keeps that port even after the conflicting process goes away, until the router is recreated (e.g. `ddev poweroff`). Routers created by earlier DDEV versions have no label, so the first start after upgrade behaves as before; the label appears at the next router recreation. Co-Authored-By: Claude Fable 5 <[email protected]>
…ontainer, for ddev#8644 ## The Issue - For ddev#8644 When a standard router port (say 443) is busy at router creation time, the router is created bound to an ephemeral substitute (say 33000). The router binds substitutes as `33000:33000`, so the container carries no trace of which standard port the ephemeral port stands in for. If the original occupant of 443 then goes away, a later `ddev start` of another project sees 443 as free and expects the router to bind it directly - a port the running router does not have - so `PortsMatch()` fails and the router is recreated unnecessarily. That recreation churn is what made `TestRouterNotRebuiltOnHostnameChange` fail on macos-orbstack and exposed the CaptureUserOut() hang on Windows. ## How This PR Solves The Issue Record the substitution decision on the object whose lifetime bounds its validity: the router container itself. - `generateRouterCompose()` writes a `com.ddev.router-port-substitutions` Docker label (e.g. `443=33000`) onto the router, merging the previous router's label with substitutions decided by the current process and dropping entries whose ephemeral port the new router no longer binds. - `GetAvailableRouterPort()` consults the label (plus the in-process map) when the proposed port looks free on the host: if the running router still has the previously-substituted ephemeral port bound, it keeps using the substitute instead of handing out the now-free standard port, avoiding the spurious recreation. Because the record lives on the container, it works across separate ddev invocations, not just within one process, and disappears naturally when the router is recreated or removed (`ddev poweroff` returns projects to their configured ports). The map is only consulted when the proposed port is free; when it is still busy, allocation goes through `AllocateAvailablePortForRouter()` as before, which honors `EphemeralRouterPortsAssigned` and gives concurrent projects distinct ephemeral ports. Also rewords the "Port X is busy" message to "Port X is not available", since with this change the substitute can be reported when the port is no longer busy, and updates the matching troubleshooting docs example. ## Manual Testing Instructions 1. Occupy ports 80/443 (or whatever your configured router ports are) with a throwaway listener. 2. `ddev start` project1; note the "Port X is not available, using Y instead" message and `docker inspect ddev-router` showing the `com.ddev.router-port-substitutions` label. 3. Kill the listener so the standard port is free again. 4. `ddev start` project2 (a separate ddev process); the router is not recreated ("ddev-router already running, pushing new config...") and project2 adopts the same substitute port. 5. `ddev poweroff && ddev start`: projects return to the standard ports. ## Automated Testing Overview - New unit tests (`TestParseFormatRouterPortSubstitutions`, `TestKnownRouterPortSubstitutions`) cover label serialization, malformed input, and label/in-process merging. - Existing `TestRouterNotRebuiltOnHostnameChange` exercises the router-recreation logic with the new label in place (passes locally). ## Release/Deployment Notes Ephemeral port substitutions become sticky for the life of the router container: once a project is substituted onto an ephemeral port, it keeps that port even after the conflicting process goes away, until the router is recreated (e.g. `ddev poweroff`). Routers created by earlier DDEV versions have no label, so the first start after upgrade behaves as before; the label appears at the next router recreation. Co-Authored-By: Claude Fable 5 <[email protected]>
…ontainer, fixes #8644 (#8653) Co-authored-by: Claude Fable 5 <[email protected]>
The Issue
No tracked issue — found via ad hoc investigation of
ddev-windows-mutagenhangs.The
ddev-windows-mutagenBuildkite pipeline hung 3 times in the last 30 hours(builds 6413,
6418,
6419), each time
running the full 6h
go test -timeoutbefore failing (6h15m-6h22m wall time),rather than failing in a reasonable amount of time. All three hung in the same
place:
TestRouterNotRebuiltOnHostnameChange, blocked writing a debug logline to stdout deep into the run (thousands of lines and hours of successful
container/network/image operations in, not on first Docker use).
Pulling the Docker Desktop version out of each build's log (
docker versionoutput near the start of the job) shows this pipeline ran cleanly on Docker
Desktop 4.77.0 → 4.78.0 → 4.79.0 across ~90 prior runs over 4+ months with zero
occurrences of this hang. The runner (
tb-win11-10, which handles nearly allddev-windows-mutagenjobs) silently auto-updated to Docker Desktop 4.84.0between build 6406 (Jul 28, passed, 4.79.0) and 6408 (Jul 29, 4.84.0).
Every build that has completed since that upgrade has hung — 3 for 3.
There's a matching, freshly-filed upstream report,
docker/desktop-feedback#560
(filed the same day as build 6419), describing Docker Desktop 4.84.0 on
Windows/WSL2 intermittently reporting its backend VM as reduced/stopped before
recovering minutes later — consistent with the backend appearing to not be
running when the runner was checked manually. No 4.84.x fix is available yet,
so this PR addresses the CI cost rather than the Docker Desktop bug itself.
How This PR Solves The Issue
Normal passing runs on this pipeline finish in ~160-220 minutes, so the
existing global
TEST_TIMEOUT=6h(shared by every CI job via theMakefile)gives a hang roughly 2x more runway than it needs before failing.
.buildkite/test.sh: threadsTEST_TIMEOUTthrough to themaketestinvocation, defaulting to today's
6hso every other pipeline is unaffected..buildkite/windows10dockerforwindows.yml: overridesTEST_TIMEOUTto4hfor this pipeline only — comfortable margin above the observed ~220m normal
max, while cutting wasted runner time on a hang from ~6h15m to ~4h15m.
This is a mitigation for the symptom (CI burning hours on a hang), not a fix
for the underlying Docker Desktop 4.84.0 backend issue, which needs to be
addressed separately (e.g. pinning/downgrading Docker Desktop on the runner
until Docker ships a fix).
Manual Testing Instructions
This only changes Buildkite CI configuration; there's no local user-facing
behavior to test. To verify:
.buildkite/test.shpassesTEST_TIMEOUTthrough tomakeanddefaults to
6hwhen unset (unchanged behavior for every pipeline besidesddev-windows-mutagen)..buildkite/windows10dockerforwindows.ymlsetsTEST_TIMEOUT: 4h.ddev-windows-mutagenruns: passing runs should beunaffected (~160-220m), and if the Docker Desktop 4.84.0 hang recurs, the
job should now fail at ~4h instead of ~6h15m+.
Automated Testing Overview
No new automated tests — this is a CI configuration change (test-timeout
plumbing), not application logic.
Release/Deployment Notes
CI-only change; no user-facing impact. Does not fix the underlying Docker
Desktop 4.84.0 backend hang — only limits how much runner time each
occurrence wastes while that's investigated/resolved separately.