Build/Test Tools: Add a start period to the MySQL healthcheck. - #12753
Build/Test Tools: Add a start period to the MySQL healthcheck.#12753adimoldovan wants to merge 2 commits into
Conversation
Without `start_period`, Docker counts the checks that run while the database initializes against the retry budget of `interval` x `retries`, which is 50 seconds. A first start of a cold volume that takes longer than that marks the container unhealthy, and every service that declares `mysql: condition: service_healthy` fails to start. A failed check inside the start period does not increment the failure streak, and the first check that passes marks the container healthy at once, so this does not slow down a normal start. See #65752.
There was a problem hiding this comment.
Pull request overview
This PR improves the reliability of the local/CI Docker Compose environment by preventing MySQL healthcheck failures during initial database initialization, which can exceed the current interval × retries budget and cause dependent services to fail to start.
Changes:
- Add
start_period: 60sto themysqlservice healthcheck to avoid counting early failures against the retry streak during cold starts.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
lancewillett
left a comment
There was a problem hiding this comment.
No blockers.
What I tested:
- Rendered the Compose config and confirmed MySQL receives
start_period: 1m0s - Confirmed dependent services still wait for
service_healthy - Reviewed the current diff and CI—all checks passed
Developed in: #12753 Props adrianmoldovanwp. Fixes #65752. git-svn-id: https://develop.svn.wordpress.org/trunk@62937 602fd350-edb4-49c9-b593-d223f7449a82
Developed in: WordPress/wordpress-develop#12753 Props adrianmoldovanwp. Fixes #65752. Built from https://develop.svn.wordpress.org/trunk@62937 git-svn-id: http://core.svn.wordpress.org/trunk@62181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The
mysqlhealthcheck setsinterval,timeout, andretries, but notstart_period. Docker therefore counts the checks that run while the database initializes against the retry budget ofinterval×retries, which is 50 seconds.The first start of a database volume creates the data directory and runs the files in
/docker-entrypoint-initdb.d. On a loaded CI runner that work can take longer than 50 seconds. Docker then marks the container unhealthy, every service that declaresmysql: condition: service_healthyfails to start, anddocker compose upfails:Example run: https://github.com/WordPress/wordpress-develop/actions/runs/30439797855/job/90536164263
This patch adds
start_period: 60s.Testing instructions
The failure needs a first start that takes more than 50 seconds. A fast machine initializes the volume in about 10 seconds, so the failure does not appear locally. Measure the margin instead:
Repeat the
inspectcommand and record how long the container staysstarting. Compare that time to the 50 second budget.Then confirm that the start period does not delay a healthy start: on this branch the container still reports
healthyat the same point it did before, not 60 seconds later.Trac ticket: https://core.trac.wordpress.org/ticket/65752
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.