Skip to content

Repair wp/6.1 branch Actions: Replace wp-env's database check with a MariaDB health check - #592

Closed
desrosj wants to merge 1 commit into
fix-actions-6.1/pin-mariadb-versionfrom
fix-actions-6.1/replace-db-check-with-healthcheck
Closed

desrosj wants to merge 1 commit into
fix-actions-6.1/pin-mariadb-versionfrom
fix-actions-6.1/replace-db-check-with-healthcheck

Conversation

@desrosj

@desrosj desrosj commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

What?

Ports WordPress#75046 ("wp-env: Fix MySQL startup race condition causing database connection errors") to this branch's wp-env:

  • The database services (mysql and tests-mysql) get a health check. It is Env: Add an option to choose the MariaDB version WordPress/gutenberg#83751's runtime check, kept in one MARIADB_HEALTHCHECK constant: it runs MariaDB's healthcheck.sh --connect --innodb_initialized only when the data directory has .my-healthcheck.cnf and the image has healthcheck.sh, and otherwise pings the server over TCP on 127.0.0.1 with mariadb-admin or mysqladmin. MARIADB_AUTO_UPGRADE is set so existing databases get the user healthcheck.sh needs.
  • wordpress and tests-wordpress depend on their database with condition: service_healthy, so Docker Compose only starts WordPress once MariaDB is ready.
  • The wp db check connection check, its 30-second retry loop and the extra 4-second sleep are removed from wp-env start.
  • wp-env start starts mysql and tests-mysql together, and wp-env clean starts only the database(s) it resets.
  • packages/env/CHANGELOG.md gets trunk's entry, extended to describe the ping fallback, with links to wp-env: Fix MySQL startup race condition causing database connection errors WordPress/gutenberg#75046 and Env: Add an option to choose the MariaDB version WordPress/gutenberg#83751.
  • The README note about wp db commands with MariaDB servers before 11.4 now says that wp-env start is not affected either, since it no longer runs wp db check.

Why?

wp db check runs mariadb-check in the cli container. The client in the current wordpress:cli image (MariaDB 11.8) requires TLS by default, and WP-CLI runs it with --no-defaults, so nothing can turn that off. MariaDB releases before 11.4 have no TLS unless it's configured, so the check fails with TLS/SSL error: SSL is required, but the server does not support it and wp-env start stops. #585 pins MariaDB 10.6, which is one of those releases, so every job that starts wp-env fails.

trunk removed wp db check in WordPress#75046 and waits for MariaDB with a health check instead, which doesn't use the MySQL client at all.

How?

The depends_on, start and clean changes follow WordPress#75046 hunk for hunk, adapted to this branch's file layout (commands/start.js, commands/clean.js and wordpress.js).

The health check command is WordPress#83751's rather than WordPress#75046's, because running healthcheck.sh unconditionally doesn't work with every version the MariaDB version setting can select:

  • The MariaDB 10.2 and 10.3 images ship healthcheck.sh without the healthcheck user, so the script fails.
  • Images built before 2022, and old patch tags such as 10.5.8 and 10.6.4, have no healthcheck.sh.
  • .my-healthcheck.cnf lives in the data volume, so it is still there when an older image without the script runs on a volume a newer image wrote. Checking only for the file would then run a missing command (exit code 127).

The fallback uses mariadb-admin when the image has it (11.0 and newer only ship that name) and mysqladmin otherwise (versions before 10.4 only ship that name). It connects to 127.0.0.1 over TCP rather than the Unix socket, which the temporary server that initializes a new volume answers before the real server is listening.

Testing:

Use of AI Tools

This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.

@desrosj
desrosj added this pull request to stack #574 September 30, 2026 10:36
@github-actions

Copy link
Copy Markdown

🤖 PR meta 🤖

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

@desrosj
desrosj force-pushed the fix-actions-6.1/replace-db-check-with-healthcheck branch 2 times, most recently from 8d6912a to bd16ad9 Compare October 5, 2026 20:47
@desrosj
desrosj removed this pull request from stack #574 October 5, 2026 20:48
@desrosj
desrosj added this pull request to stack #611 October 5, 2026 20:48
@desrosj
desrosj force-pushed the fix-actions-6.1/replace-db-check-with-healthcheck branch from bd16ad9 to bf202fb Compare October 5, 2026 21:12
@desrosj
desrosj force-pushed the fix-actions-6.1/replace-db-check-with-healthcheck branch from bf202fb to aeb3d8b Compare October 6, 2026 14:20
@desrosj
desrosj removed this pull request from stack #611 October 6, 2026 14:20
@desrosj
desrosj added this pull request to stack #621 October 6, 2026 14:21
@desrosj
desrosj force-pushed the fix-actions-6.1/replace-db-check-with-healthcheck branch from aeb3d8b to 6e4e55e Compare October 6, 2026 15:46
@desrosj
desrosj removed this pull request from stack #621 October 7, 2026 18:02
@desrosj
desrosj changed the base branch from fix-actions-6.1/pin-mariadb-version to wp/6.1 October 7, 2026 18:02
@desrosj
desrosj force-pushed the fix-actions-6.1/replace-db-check-with-healthcheck branch from 6e4e55e to 98dcc78 Compare October 7, 2026 18:04
@desrosj
desrosj changed the base branch from wp/6.1 to fix-actions-6.1/pin-mariadb-version October 7, 2026 18:05
@desrosj
desrosj added this pull request to stack #667 October 7, 2026 18:05
@desrosj
desrosj marked this pull request as ready for review October 8, 2026 03:29
@github-actions

github-actions Bot commented Oct 8, 2026

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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: desrosj <desrosj@git.wordpress.org>

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

@desrosj

desrosj commented Oct 8, 2026

Copy link
Copy Markdown
Owner Author

Moved to WordPress#84260.

@desrosj desrosj closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant