Repository navigation
fix(ddev-webserver): ddev stop takes 10s due to bash deferring SIGTERM during foreground cat, fixes #8295 - #8396
Merged
Conversation
…being handled
## The Issue
`ddev stop` always takes ~10 seconds because Docker sends SIGTERM to PID 1
(`pre-start.sh`) and the container never exits cleanly, forcing Docker to
wait the full default stop_grace_period before sending SIGKILL.
## How This PR Solves The Issue
Bash does not process signal traps while a foreground command is running.
`cat < ${logpipe}` was blocking in the foreground, so the SIGTERM trap
never fired, `kill -- -1` never ran, supervisord was never told to stop,
nobody closed the write end of the pipe, and `cat` never got EOF — a
deadlock lasting exactly 10 seconds every time.
Fix: background `cat` and use `wait` instead. `wait` is a bash builtin
that allows signal processing, so SIGTERM fires the trap immediately,
`kill -- -1` stops all container processes, and the container exits cleanly
in under a second.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Download the artifacts for this pull request:
See Testing a PR. |
ddev stop takes 10s due to bash deferring SIGTERM during foreground cat, fixes #8295
stasadev
approved these changes
May 9, 2026
stasadev
left a comment
Member
There was a problem hiding this comment.
Wow, so many test wins!
| Check | Main | PR | Difference |
|---|---|---|---|
| Docs Quickstart test | 56m | 40m | PR faster by 16m |
| All Project Types / test | 130m | 82m | PR faster by 48m |
| Apache-FPM / test | 110m | 72m | PR faster by 38m |
| Docker Rootless / test | 122m | 87m | PR faster by 35m |
| Mutagen / test | 124m | 79m | PR faster by 45m |
| Nginx-FPM / test | 114m | 75m | PR faster by 39m |
| No Bind Mounts / test | 115m | 89m | PR faster by 26m |
| Podman Rootless / testcmd | 86m | 73m | PR faster by 13m |
| Podman Rootless / testpkg-1 | 52m | 42m | PR faster by 10m |
| Podman Rootless / testpkg-2 | 58m | 48m | PR faster by 10m |
| Race Detection / test | 143m | 109m | PR faster by 34m |
| WSL2 (nat) | 197m | 176m | PR faster by 21m |
| buildkite/ddev-macos-arm64-mutagen | 102m | 98m | PR faster by 4m |
| buildkite/macos-colima-vz | 109m | 59m | PR faster by 50m |
| buildkite/macos-lima | 94m | 64m | PR faster by 30m |
| buildkite/macos-orbstack | 93m | 60m | PR faster by 33m |
The add-on tests will be faster too, since all of them run ddev restart.
Collaborator
|
wow, the amount of minutes saved is massive! |
Member
Author
|
Your improved UI made this possible @stasadev ! |
stasadev
added a commit
to ddev-test/ddev
that referenced
this pull request
May 11, 2026
…e unused workflows [skip buildkite] ## The Issue From ddev#8396 (review): | Check | Main | PR | Difference | |---|---|---|---| | Podman Rootless / testcmd | 86m | 73m | PR faster by 13m | | Podman Rootless / testpkg-1 | 52m | 42m | PR faster by 10m | | Podman Rootless / testpkg-2 | 58m | 48m | PR faster by 10m | | WSL2 (nat) | 197m | 176m | PR faster by 21m | We don't need to split testpkg for Podman anymore, it can be done as one job. WSL2 (nat) takes too much time, it's better to split it into testcmd/testpkg ## How This PR Solves The Issue - Improves CI workflow structure for faster and more flexible test runs - **Split testpkg/testcmd**: All podman and WSL2 workflows now run `testpkg` and `testcmd` as separate parallel jobs instead of a combined `test` target, reducing wall-clock time - **Remove A-G/H-Z testpkg split**: Podman rootless/root workflows previously split testpkg into two regex-filtered halves; these are merged into a single `testpkg` job now that testpkg+testcmd run in parallel - **WSL2 refactored**: `test-wsl2.yml` replaced with a reusable `test-wsl2-reusable.yml` plus separate `test-wsl2-nat.yml` and `test-wsl2-mirrored.yml` (mirrored not yet running, pending microsoft/WSL#11154) - **Custom dispatch jobs**: All test workflows gain a `workflow_dispatch`-only custom job with `make_target` (choice), `testargs`, `gotest_short`, and `makeargs` inputs, allowing any test target to be run manually from the GitHub Actions UI without changing workflow files - **Removed unused workflows**: `colima-tests.yml`, `test-podman-root.yml`, `test-podman-root-mutagen.yml` removed as they were not running - **actions/checkout v5 → v6**: Bumped across all workflows ## Manual Testing Instructions - Trigger any test workflow via `workflow_dispatch` and verify the custom job appears with dropdown options for `make_target` - Verify PR/push triggers run the standard split jobs (not the custom job) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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
ddev powerofftakes longer than it should, seems to hang after each project is stopped #8295ddev stopalways takes ~10 seconds. Soddev powerofftakes a long timeHow This PR Solves The Issue
ddev stopandddev poweroff, so it was clear what was happening. The web container was taking 10s to stop... for no particular reason.pre-start.shruns as PID 1 in the web container. It sets a SIGTERM trap tokill -- -1(kill all processes in the container), then blocks oncat < ${logpipe}.The bug: bash does not process signal traps while a foreground command is running. With
catin the foreground, the SIGTERM trap never fires when Docker sends SIGTERM to PID 1.kill -- -1never runs, supervisord is never told to stop, nobody closes the write end of the named pipe,catnever gets EOF — a complete deadlock. Docker waits the full 10-second default grace period and then sends SIGKILL.Fix: background
catand usewaitinstead.waitis a bash builtin that does allow signal processing, so SIGTERM fires the trap immediately,kill -- -1stops all container processes, and the container exits cleanly in under a second.Confirmed:
supervisorctl stop allinside the container stops all processes (nginx, php-fpm, cron, mailpit) near-instantly, so there was never a problem with the supervised processes themselves — only with the signal never reaching the trap.Timing
With v1.25.2: 11.5s to
ddev stopWith this PR, 1.4s to
ddev stopManual Testing Instructions
ddev starta projectddev start && time ddev stop— should be way fasterddev logsandddev logs -fshould work the sameAutomated Testing Overview
No changes
Release/Deployment Notes
ddev stopandddev poweroffare much faster