#66117 closed defect (bug) (fixed)
Build/Test Tools: The database healthcheck pings the unix socket, so it passes before the TCP server is up
| Reported by: | lucatume | Owned by: | lancewillett |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Build/Test Tools | Version: | trunk |
| Severity: | normal | Keywords: | has-patch dev-reviewed |
| Cc: | Focuses: |
Description (last modified by )
The mysql service healthcheck in docker-compose.yml pings the database with -h localhost. To the MySQL and MariaDB clients, localhost means "use the Unix socket". It is the one hostname that does not go over the network: 127.0.0.1 and every other host connect over TCP.
While a cold database volume is initialised, the entrypoint of both images starts a temporary server with --skip-networking, on the same socket path:
# mariadb, docker-entrypoint.sh
"$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" ...
# mysql, docker-entrypoint.sh
if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then
That temporary server answers the socket ping, but binds no listener on port 3306. The container is therefore reported healthy before it accepts a single connection over the network, and depends_on: condition: service_healthy releases the cli, php and nginx containers too early. WP-CLI then fails with:
Error: Database connection error (2002) Connection refused
Measurement
Running the resolved healthcheck command in a tight loop against a cold volume, and recording the first probe at which it passes versus the first probe at which port 3306 accepts a connection. Docker's own 5 second sampling interval can step over the window entirely, which is why the check has to be exercised directly:
engine healthcheck passed TCP accepted mysql 8.4 probe 44 probe 76 mariadb 11.4 probe 40 probe 67
On MySQL 8.4 the entrypoint stops the temporary server before it starts the final one, so in the middle of that window there is no server running at all, and even the socket stops answering. Docker has already marked the container healthy by then, and it only reverts to unhealthy after retries consecutive failures, which at the current settings is 10 probes at a 5 second interval. The container therefore stays marked healthy across a period when mysqld is not running and calls will fail.
Proposed fix
Ping over TCP, so the check cannot pass against the temporary server:
-h 127.0.0.1 --protocol=tcp
No credentials are required. mysqladmin ping and mariadb-admin ping exit 0 on Access denied, which is the correct result here: the check asserts that the server is reachable, not that the caller can authenticate.
Note that switching from localhost to 127.0.0.1 is sufficient as providing an IP address will make the check run using TCP, the --protocol=tcp part is redundant and added to make the nature of the check explicit.
Verified against mysql 5.7, mysql 8.4, mariadb 10.3 and mariadb 11.4, covering both branches of the version conditional in the healthcheck. In every case the check no longer passes before the port accepts connections, and docker compose up -d --wait mysql reports healthy in 10-11 seconds on a cold volume, well inside the existing 60 second start_period.
Relationship to other tickets
#65742 fixed the same symptom in tools/local-env/scripts/install.js by retrying wp config create until it succeeds ([62938]). That retry works, but it treats one WP-CLI command as the readiness probe and leaves the healthcheck reporting the wrong thing to every other consumer of depends_on. This ticket is about the healthcheck predicate itself.
#64579 reports the same symptom as #65742 and is still open; it looks like a duplicate.
#65752 and #65799 both adjusted this healthcheck for unrelated reasons.
Backporting
Every branch back to 4.7 runs its PHPUnit CI through reusable-phpunit-tests-v1/v2/v3.yml@trunk, which checks out the caller's branch and runs npm run env:start and npm run env:install against it. The compose file in effect is the branch's own, so a fix on trunk does not reach them. The same one-line change applies to all of them, in two variants: 4.7 through 6.7 carry the simple form of the healthcheck, 6.8 and trunk carry the version-cased form.
Change History (93)
This ticket was mentioned in PR #13563 on WordPress/wordpress-develop by @lucatume.
2 months ago
#3
- Keywords has-patch added
#5
@
2 months ago
- Owner set to
- Status new → accepted
Keeping this ticket open to land the backports to older WordPress version branches.
@lancewillett commented on PR #13563:
2 months ago
#6
https://core.trac.wordpress.org/changeset/63871 for trunk
@lucatume Are you also working on backporting this fix to 7.1 through 6.8?
@lucatume commented on PR #13563:
8 weeks ago
#7
https://core.trac.wordpress.org/changeset/63871 for trunk
@lucatume Are you also working on backporting this fix to 7.1 through 6.8?
Thanks @lancewillett.
Yes: I'm backporting the fix to older branches, if possible back to WordPress 4.7.
This ticket was mentioned in PR #13686 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#8
Backports [63871] to the 7.1 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early. On this branch wp_cli_retry() already absorbs the resulting Database connection error (2002) in env:install; this removes the early "healthy" state itself. This pings -h 127.0.0.1 --protocol=tcp instead.
Changes docker-compose.yml and tools/local-env/scripts/install.js. The two workflow files the trunk commit touches don't exist on this branch, so they're left out.
Checked on a cold volume on the 6.8 branch (mysql 8.4) and the 7.1 branch (mysql 9.7, mariadb 10.3, mariadb 11.4), probing the old and the new command side by side until TCP came up: the old socket ping passed 7-21 probes while TCP was still down; the new one passed none. The healthcheck is the same on 6.8-7.1. docker compose config -q is clean.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Cherry-picking, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13687 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#9
Backports [63871] to the 7.0 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early and WP-CLI fails with Database connection error (2002). This pings -h 127.0.0.1 --protocol=tcp instead.
Changes docker-compose.yml only. The two workflow files the trunk commit touches don't exist on this branch, and install.js has no wp_cli_retry() here, so its comment change doesn't apply.
Checked on a cold volume on the 6.8 branch (mysql 8.4) and the 7.1 branch (mysql 9.7, mariadb 10.3, mariadb 11.4), probing the old and the new command side by side until TCP came up: the old socket ping passed 7-21 probes while TCP was still down; the new one passed none. The healthcheck is the same on 6.8-7.1. docker compose config -q is clean.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Cherry-picking, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13688 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#10
Backports [63871] to the 6.9 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early and WP-CLI fails with Database connection error (2002). This pings -h 127.0.0.1 --protocol=tcp instead.
Changes docker-compose.yml only. The two workflow files the trunk commit touches don't exist on this branch, and install.js has no wp_cli_retry() here, so its comment change doesn't apply.
Checked on a cold volume on the 6.8 branch (mysql 8.4) and the 7.1 branch (mysql 9.7, mariadb 10.3, mariadb 11.4), probing the old and the new command side by side until TCP came up: the old socket ping passed 7-21 probes while TCP was still down; the new one passed none. The healthcheck is the same on 6.8-7.1. docker compose config -q is clean.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Cherry-picking and resolving the docker-compose.yml conflict, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13689 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#11
Backports [63871] to the 6.8 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early and WP-CLI fails with Database connection error (2002). This pings -h 127.0.0.1 --protocol=tcp instead.
Changes docker-compose.yml only. The two workflow files the trunk commit touches don't exist on this branch, and install.js has no wp_cli_retry() here, so its comment change doesn't apply. upgrade-testing.yml calls reusable-upgrade-testing.yml@trunk, so it already gets the trunk fix for the CI healthcheck.
Checked on a cold volume on the 6.8 branch (mysql 8.4) and the 7.1 branch (mysql 9.7, mariadb 10.3, mariadb 11.4), probing the old and the new command side by side until TCP came up: the old socket ping passed 7-21 probes while TCP was still down; the new one passed none. The healthcheck is the same on 6.8-7.1. docker compose config -q is clean.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Cherry-picking and resolving the docker-compose.yml conflict, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
#12
@
8 weeks ago
Currently there are PRs open to backport the fix from versions 6.8 to 7.1, but lower versions will benefit from this as well.
I'm testing them in my fork and, once the currently open PRs are merged, I will open the PRs on the core repository to patch from 4.7 to 6.7.
#13
@
8 weeks ago
- Keywords dev-reviewed added
[63871] looks good for partial to backport down to 6.8 based on the PRs:
https://github.com/WordPress/wordpress-develop/pull/13686
https://github.com/WordPress/wordpress-develop/pull/13687
https://github.com/WordPress/wordpress-develop/pull/13688
https://github.com/WordPress/wordpress-develop/pull/13689
@lancewillett commented on PR #13686:
8 weeks ago
#18
PR #13686 — 7.1 landed in https://core.trac.wordpress.org/changeset/63920
@lancewillett commented on PR #13687:
8 weeks ago
#19
PR #13687 — 7.0 landed in https://core.trac.wordpress.org/changeset/63921
@lancewillett commented on PR #13688:
8 weeks ago
#20
PR #13688 — 6.9 landed in https://core.trac.wordpress.org/changeset/63922
@lancewillett commented on PR #13689:
8 weeks ago
#21
PR #13689 — 6.8 landed in https://core.trac.wordpress.org/changeset/63923
This ticket was mentioned in PR #13729 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#22
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 4.7 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13730 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#23
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 4.8 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13731 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#24
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 4.9 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13732 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#25
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 5.0 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13733 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#26
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 5.1 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13734 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#27
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 5.2 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13735 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#28
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 5.3 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13736 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#29
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 5.4 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13737 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#30
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 5.5 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13738 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#31
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 5.6 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13739 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#32
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 5.7 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13740 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#33
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 5.8 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13741 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#34
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 5.9 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13742 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#35
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 6.0 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13743 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#36
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 6.1 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13744 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#37
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 6.2 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13745 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#38
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 6.3 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13746 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#39
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 6.4 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13747 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#40
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 6.5 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13748 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#41
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 6.6 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
This ticket was mentioned in PR #13749 on WordPress/wordpress-develop by @lucatume.
8 weeks ago
#42
Backport of r63871 (trunk via #13563), r59484 and r59489 to the 6.7 branch.
The mysql container healthcheck pinged -h localhost, which the client resolves to the Unix socket. On a cold volume the entrypoint's temporary --skip-networking server answers the socket before the real server listens on 3306, so the container reports healthy too early, and the php, cli and nginx containers start before the database accepts connections. This pings -h 127.0.0.1 --protocol=tcp instead (r63871).
The healthcheck on this branch also calls mariadb-admin for any MariaDB version. MariaDB 10.3 and earlier don't ship it, so the container can't report healthy on those versions. This brings in the version check from r59484, and the $$? escaping from r59489, so the healthcheck block matches trunk.
Changes docker-compose.yml only. The healthcheck line being replaced is the same on 4.7 to 6.7.
Checked on a cold volume, probing the old and the new command side by side until TCP came up:
| Branch | Database | Old command passed while TCP was down | New command |
|---|---|---|---|
| 4.7 | mysql 5.7 | 14 probes | 0 |
| 6.7 | mysql 8.0 | 10 probes | 0 |
| 6.7 | mariadb 10.3 | 19 probes | 0 |
With the unpatched 6.7 healthcheck on mariadb 10.3, every check fails with mariadb-admin: not found (exit 127). docker compose config -q is clean on all 21 branches.
Testing instructions
npm run env:stop, remove themysqlvolume,npm run env:start.docker compose psshowsmysqlhealthy only afterdocker compose exec mysql mysqladmin ping -h 127.0.0.1 --protocol=tcp -ppasswordsucceeds.- Repeat with
LOCAL_DB_TYPE=mariadbandLOCAL_DB_VERSION=10.3: the container becomes healthy (before this change it never did).
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the change across branches, measuring the healthcheck race and drafting this description. I've reviewed and take responsibility for all of it.
@jorbin commented on PR #13746:
7 weeks ago
#43
When I test this change, the mysql container doesn't start.
`
Container wordpress-mysql-1 Error dependency mysql failed to start 2.6s
dependency failed to start: container wordpress-mysql-1 exited (1)
@lancewillett commented on PR #13746:
7 weeks ago
#44
Thanks for testing. I tried the 6.4 branch before and after this patch with MySQL 8.0 and fresh database volumes; both started successfully.
CI also passed on the current revision: 41 successful checks, six skipped, and nothing pending. That supports the patch in the CI configurations, but does not explain the local startup failure.
Could you share the output of docker compose images mysql and docker compose logs --tail=100 mysql?
One possibility: MySQL 8.4 rejects this branch’s existing --default-authentication-plugin=mysql_native_password option. I reproduced that exit-code-1 failure locally, but the option is unchanged by this PR. The logs should tell us whether that explains your result.
---
<sub>Adversarial review · <code>gpt-6</code></sub>
@lancewillett commented on PR #13749:
7 weeks ago
#46
PR #13749 for 6.7 backport landed in https://core.trac.wordpress.org/changeset/63978
@lancewillett commented on PR #13748:
7 weeks ago
#48
PR #13748 for 6.6 backport landed in https://core.trac.wordpress.org/changeset/63979
@lancewillett commented on PR #13747:
7 weeks ago
#50
PR #13747 for 6.5 backport landed in https://core.trac.wordpress.org/changeset/63980
@lucatume commented on PR #13746:
7 weeks ago
#54
I've reproduced the exited (1) locally by starting this branch (MySQL 8.0) on a mysql volume already initialized by trunk (MySQL 9.7); both branches use the same wordpress_mysql volume, and MySQL 8.0 refuses to downgrade the data directory, I see Cannot downgrade from 90702 to 80046 in the mysql in the container logs.
The unpatched 6.4 branch fails the same way on that volume following the start on trunk, stop, do not remove volume and re-start on 6.4.
Running npm run env:clean and then npm run env:start fixes it for me.
I reproduced the failure with:
git checkout trunk npm ci npm run env:start npm run env:install npm run env:stop git checkout 6.4 npm ci npm run env:start # Wait for failure docker compose logs mysql | grep 'Cannot downgrade'
@lancewillett commented on PR #13729:
11 days ago
#55
@adimoldovan @aaronjorbin following up on the Sep 25 request: this and its 17 sibling backports (#13730–#13746) have my approval and green CI. They need a second review before landing. One look at this PR covers the set, since the change is the same on every branch.
<sub>AI review · <code>claude-opus-5-5</code></sub>
@lancewillett commented on PR #13746:
6 days ago
#58
PR #13746 landed in https://core.trac.wordpress.org/changeset/65446
@lancewillett commented on PR #13745:
6 days ago
#59
PR #13745 landed in https://core.trac.wordpress.org/changeset/65447
@lancewillett commented on PR #13744:
6 days ago
#62
PR #13744 landed in https://core.trac.wordpress.org/changeset/65448
@lancewillett commented on PR #13743:
6 days ago
#63
PR #13743 landed in https://core.trac.wordpress.org/changeset/65449
@lancewillett commented on PR #13742:
6 days ago
#65
PR #13742 landed in https://core.trac.wordpress.org/changeset/65450
@lancewillett commented on PR #13741:
6 days ago
#67
PR #13741 landed in https://core.trac.wordpress.org/changeset/65451
@lancewillett commented on PR #13740:
6 days ago
#80
PR #13740 landed in https://core.trac.wordpress.org/changeset/65452
@lancewillett commented on PR #13739:
6 days ago
#81
PR #13739 landed in https://core.trac.wordpress.org/changeset/65453
@lancewillett commented on PR #13738:
6 days ago
#82
PR #13738 landed in https://core.trac.wordpress.org/changeset/65454
@lancewillett commented on PR #13737:
6 days ago
#83
PR #13737 landed in https://core.trac.wordpress.org/changeset/65455
@lancewillett commented on PR #13736:
6 days ago
#84
PR #13736 landed in https://core.trac.wordpress.org/changeset/65456
@lancewillett commented on PR #13735:
6 days ago
#85
PR #13735 landed in https://core.trac.wordpress.org/changeset/65458
@lancewillett commented on PR #13734:
6 days ago
#86
PR #13734 landed in https://core.trac.wordpress.org/changeset/65459
@lancewillett commented on PR #13733:
6 days ago
#87
PR #13733 landed in https://core.trac.wordpress.org/changeset/65460
@lancewillett commented on PR #13732:
6 days ago
#88
PR #13732 landed in https://core.trac.wordpress.org/changeset/65461
@lancewillett commented on PR #13731:
6 days ago
#89
PR #13731 landed in https://core.trac.wordpress.org/changeset/65462
@lancewillett commented on PR #13730:
6 days ago
#90
PR #13730 landed in https://core.trac.wordpress.org/changeset/65463
@lancewillett commented on PR #13729:
6 days ago
#91
PR #13729 landed in https://core.trac.wordpress.org/changeset/65464
The
mysqlcontainer healthcheck pings-h localhost. Both the MySQL and the MariaDB client resolve the literallocalhostto the Unix socket, never to TCP.While a cold volume is initialised,
docker-entrypoint.shstarts a temporary server with--skip-networking. That server answers on the socket but binds no listener on port 3306, so the healthcheck passes and the container is reported healthy while nothing can reach it over the network.depends_on: condition: service_healthythen releases thecli,phpandnginxcontainers too early, and WP-CLI fails with:This pings
-h 127.0.0.1 --protocol=tcpinstead, so the check can pass only once the final server is listening.Measurements
Running the resolved healthcheck predicate in a tight loop against a cold volume, and comparing the probe on which it first passes against the probe on which the port first accepts a connection:
Those four cover both branches of the version conditional in the check, and all three ping call sites.
docker compose up -d --wait mysqlreaches healthy in 5–11s on a cold volume, well inside the existing 60sstart_period.The same defect in CI
install-testing.ymlandreusable-upgrade-testing.ymlstart theirdatabaseservice with--health-cmd="mysqladmin ping"and no host argument at all, so it defaults tolocalhostand hits the socket. A service container always starts on a cold volume, and the steps connect to the mapped port with--dbhost="127.0.0.1:$PORT", so it is the same mismatch. Measured the same way, with the workflows' ownMYSQL_ROOT_PASSWORDandMYSQL_DATABASEsettings, the old command passed 22 probes (mysql 5.7) and 29 probes (mysql 8.4) before the port accepted connections.The race is usually masked there by the 30s
--health-interval, since the first probe lands after initialisation has finished. That interval is left alone: it is what makes this latent rather than a visible failure, and shortening it is a separate question.Both also now select the client from
db-typeanddb-version, the way the Docker healthcheck already does.reusable-upgrade-testing.ymldocumentsdb-typeas acceptingmariadb, but the binary name was hardcoded, and MariaDB dropped themysqladminsymlink in 11.0:mysqladminmariadb-adminEvery caller passes
mysqltoday, so this has not fired, but amariadb: 11.xcaller would have waited out the retries on a check that could never run. Verified end to end on both branches of the new conditional: mariadb 10.3 viamysqladmin, mariadb 11.4 viamariadb-admin, neither passing before the port accepted.On
--protocol=tcpIt is belt and braces next to
-h 127.0.0.1, and deliberately so. Measured on every image above, the host argument alone already picks TCP: with no server listening the client reportsCan't connect to MySQL server on '127.0.0.1', where-h localhostreportsCan't connect to local MySQL server through socket. Only the literallocalhostselects the socket.The flag is kept because it states the invariant the check depends on, rather than leaving it implied by a client-specific special case that a later edit could quietly undo. It also makes the check immune to a
protocol=socketin a client option file, which would otherwise override the host argument.The
env:installretryThe comment above
wp_cli_retry()intools/local-env/scripts/install.jscited this broken healthcheck as the reason the retry exists. That is no longer accurate, so it is reworded to describe what the retry still covers:env:installcan be run on its own, withoutenv:starthaving waited for the container to report healthy.The retry itself, added in [62938] for #65742, is unchanged.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Reviewing the fix, measuring client transport selection and healthcheck timing across the database images, locating the same defect in the two CI workflows, and drafting the commit messages and this description. The change itself is a host and protocol argument on five ping invocations, a client name made conditional, and three comments; I reviewed and take responsibility for all of it.