Repository navigation
fix: stop a stale healthy marker from delaying restarted web and xhgui containers by 59s (#9019) [skip ci] - #9019
Conversation
|
Download this PR's build for your OS and architecture with: ddev utility download-ddev --pr 9019Or download the artifact for your OS and architecture directly:
See Testing a PR. |
|
Pushed updated container image(s) for this PR:
|
rfay
left a comment
There was a problem hiding this comment.
Looks like a good idea to me. I wonder if there's a way to generalize this even more.
Also, the fact that Docker has not (yet) provided a way to back off the healthchecks after healthy even though it would have made sense is worth looking into again, in case they've done something to make this obsolete.
This complexity was originally added because of complaints about battery life on laptops, and it's mostly worked out OK, but this is a great case where it doesn't necessarily.
I agree, and would like to have something simpler, but not here. |
…i containers by 59s ## Short Summary (TL;DR) A web or xhgui container that Docker stopped and started again could take about 60 seconds to become healthy. Both images now remove the stale `/tmp/healthy` marker in PID 1, before the first healthcheck probe runs. ## The Issue @rpkoller reported `Waiting for containers to become ready: [web db]... ready in 58.0s` on macOS with Mutagen. The web log showed the same container running twice, with a stop in between. Quitting Docker or rebooting the host also stops containers without removing them. The container's writable layer keeps `/tmp/healthy` from its last run. `healthcheck.sh` sleeps 59 seconds when it finds that file. Docker runs the first probe 1 second after the container starts. - web: `/start.sh` removes the marker, but `ddev start` runs `/start.sh` through `docker exec` only after the Mutagen sync. With a 1.9s Mutagen flush, the first probe finds the stale marker. - xhgui: nothing removes the marker, so `ddev xhgui on` waits 59 seconds after a stop. The db, router, and ssh-agent entrypoints already remove the marker as PID 1. ## How This PR Solves The Issue - web: `pre-start.sh`, which is PID 1, removes `/tmp/healthy` first. `/start.sh` keeps its own `rm` for a `ddev start` on a container that is already up. - xhgui: a `CMD` removes `/tmp/healthy`, then starts nginx and php-fpm with the command from `xhgui/xhgui:0.23`. ## Manual Testing Instructions ```bash ddev utility download-ddev --pr 9019 export PATH="$HOME/tmp/ddev-download-ddev/pr-9019:$PATH" mkdir ~/tmp/healthyrepro && cd ~/tmp/healthyrepro ddev config --project-type=php --performance-mode=mutagen ddev start -y docker stop ddev-healthyrepro-web # A slower Mutagen flush makes the race reproduce on fast hosts mkdir bulk && (cd bulk && seq 1 30000 | xargs touch) ddev start -y # Expect "ready in" a few seconds; v1.25.5 shows about 56s here ddev xhgui on docker stop ddev-healthyrepro-xhgui ddev xhgui on # Expect the xhgui wait to take a few seconds, not about 60s ``` 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <[email protected]>
68ffd41 to
cd11299
Compare
|
lol i've first tested with the artifact and wondered why nothing happened. but then realized that the artifact provides the fixes and i also have to test with HEAD in comparison. in doing so i can confirm, with HEAD the web container took 575 seconds to start up and xhgui 60 seconds exactly. so the PR is fixing the problem. thank you! |
Short Summary (TL;DR)
A web or xhgui container that Docker stopped and started again could take about 60 seconds to become healthy. Both images now remove the stale
/tmp/healthymarker in PID 1, before the first healthcheck probe runs.The Issue
@rpkoller reported
Waiting for containers to become ready: [web db]... ready in 58.0son macOS with Mutagen. The web log showed the same container running twice, with a stop in between. Quitting Docker or rebooting the host also stops containers without removing them.The container's writable layer keeps
/tmp/healthyfrom its last run.healthcheck.shsleeps 59 seconds when it finds that file. Docker runs the first probe 1 second after the container starts./start.shremoves the marker, butddev startruns/start.shthroughdocker execonly after the Mutagen sync. With a 1.9s Mutagen flush, the first probe finds the stale marker.ddev xhgui onwaits 59 seconds after a stop.The db, router, and ssh-agent entrypoints already remove the marker as PID 1.
How This PR Solves The Issue
pre-start.sh, which is PID 1, removes/tmp/healthyfirst./start.shkeeps its ownrmfor addev starton a container that is already up.CMDremoves/tmp/healthy, then starts nginx and php-fpm with the command fromxhgui/xhgui:0.23.Manual Testing Instructions
🤖 Developed with assistance from Claude Code