Skip to content

Build/Test Tools: Add a start period to the MySQL healthcheck. - #12753

Closed
adimoldovan wants to merge 2 commits into
WordPress:trunkfrom
adimoldovan:65752-mysql-healthcheck-start-period
Closed

Build/Test Tools: Add a start period to the MySQL healthcheck.#12753
adimoldovan wants to merge 2 commits into
WordPress:trunkfrom
adimoldovan:65752-mysql-healthcheck-start-period

Conversation

@adimoldovan

@adimoldovan adimoldovan commented Jul 29, 2026

Copy link
Copy Markdown

The mysql healthcheck sets interval, timeout, and retries, but not start_period. Docker therefore counts the checks that run while the database initializes against the retry budget of interval × 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 declares mysql: condition: service_healthy fails to start, and docker compose up fails:

09:33:37  Container wordpress-develop-mysql-1  Started
09:33:37  Container wordpress-develop-mysql-1  Waiting
09:34:27  Container wordpress-develop-mysql-1  Error
          dependency failed to start: container wordpress-develop-mysql-1 is unhealthy

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:

npm run env:stop
docker compose down -v
docker compose up -d mysql
docker inspect --format '{{.State.Health.Status}}' $(docker compose ps -q mysql)

Repeat the inspect command and record how long the container stays starting. 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 healthy at 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.

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.
Copilot AI review requested due to automatic review settings July 29, 2026 11:18
@adimoldovan adimoldovan self-assigned this Jul 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: 60s to the mysql service 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.

@adimoldovan
adimoldovan marked this pull request as ready for review July 29, 2026 11:39
@adimoldovan
adimoldovan requested review from Copilot and desrosj July 29, 2026 11:39
@github-actions

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props adrianmoldovanwp.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

pento pushed a commit that referenced this pull request Jul 29, 2026
Developed in: #12753

Props adrianmoldovanwp.
Fixes #65752.


git-svn-id: https://develop.svn.wordpress.org/trunk@62937 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 62937
GitHub commit: 123f966

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants