Repository navigation
Remove the obsolete mysql_ssl_rsa_setup from the MySQL 8 test image - #112967
nikitamikhaylov merged 1 commit into
Conversation
Integration modules using with_mysql8=True sporadically fail their entire module with "Exception: Cannot wait MySQL 8 container". Seen on 6 unrelated PRs over the last 90 days (0 on master) across 4 job flavours, including arm_binary and amd_llvm_coverage. The MySQL 8 container's entrypoint calls mysql_ssl_rsa_setup under "set -eo pipefail", inside docker_init_database_dir: after the datadir bootstrap, but before docker_setup_db, which is the function that applies the MYSQL_ROOT_HOST=% grant. A non-zero exit from that call therefore aborts the entrypoint before the grant is created. "restart: always" on the compose service then relaunches the container, and the second run finds an initialized datadir, so DATABASE_ALREADY_EXISTS is set and the whole initialization block, grant included, is skipped for good. The server consequently comes up healthy while knowing only root@localhost, and every connection from the docker gateway is rejected with MySQL error 1130. That error is issued before authentication and is permanent, so wait_mysql8_to_start cannot recover from it and burns its full 180 s budget before raising. In one collected report the waiter logged 342 such rejections while the server had already been ready for 171 s. Because the fixture is module-scoped, all 21 tests of the module were reported as failures from that single event. This finishes what ClickHouse#96252 started. That PR pre-generated all 11 cert and key files and turned off server-side RSA generation, but left the entrypoint-side generator in the image. The generator is dead work here: every SSL and RSA path the server actually uses points at the bind-mounted /etc/mysql/certs, and the eight .pem files this tool writes into the datadir are read by nothing. The server log confirms it skips generation of its own accord. Removing the executable makes the entrypoint's own "command -v" guard skip the step, so initialization proceeds to the grant. rm -f keeps the layer idempotent should a future base image ship without the binary. Verified by injecting a deliberately failing mysql_ssl_rsa_setup, so both arms run the same failing binary and only the fix differs. With it present: RestartCount=1, a grant table holding only root@localhost, and 344 occurrences of error 1130 (the collected report shows 342), plus the same 16 initial connection-refused errors. With it removed: RestartCount=0, root@'%' present, and the waiter succeeds. Six with_mysql8 modules show an identical failure set before and after, including test_storage_mysql, which also exercises the untouched official mysql:8.0 cluster nodes. What makes that step fail in the wild is still unidentified: it did not fail once in 480 local invocations under load. Since the step is dead work in this configuration, removing it eliminates the failure mode regardless of the trigger. wait_mysql8_to_start now also reports the per-attempt errors it collects, matching the three sibling MySQL waiters. It was the only one discarding them, which is why the raised exception carried no diagnostics and this signature went undiagnosed across six PRs. No fatal-fast on 1130 is added: that would convert a future transient into a hard failure.
Internal second-model review (click to expand)Two independent reviews were run against this diff before publishing: a cold read by a The cold read raised no blockers and no majors. It re-derived the root cause from the base 💡 Three notes, all addressed in the text of this pull request rather than in code. The generality argument was strengthened. Saying the other MySQL services are "untouched
The claim that the waiter "discarded" its errors was also softened. It logged each attempt at Every countable figure in the description was re-derived at review time rather than carried |
Pre-PR validation gate (click to expand)
Known limitation, disclosed rather than omitted: what makes Session id: cron:clickhouse-impl-slot-42:20260801-225300 |
|
cc @fm4v @leshikus, could you review this? The MySQL 8 test image's entrypoint calls |
|
Workflow [PR], commit [c20a047] Summary: ✅ AI ReviewSummaryThis PR removes Tests
Final Verdict
|
| && apt-get install -y iptables iproute2 curl \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
| && rm -rf /var/lib/apt/lists/* \ | ||
| && rm -f /usr/bin/mysql_ssl_rsa_setup |
There was a problem hiding this comment.
This changes the MySQL 8 image's bootstrap contract, but the PR still has no deterministic regression that proves the image reaches docker_setup_db and creates root@'%' without mysql_ssl_rsa_setup. The existing with_mysql8 suites only surface this if the upstream helper happens to fail again, so today the fix is still validated by manual reproduction only. Please add the focused startup check described in the PR body (for example, fault-inject mysql_ssl_rsa_setup and assert bootstrap reaches the grant step / wait_mysql8_to_start succeeds).
There was a problem hiding this comment.
I checked the ask against the harness before answering. Declining the fault-injected test, for three measured reasons, and pointing at the coverage that already exists.
The assertion you describe already runs as a hard gate on all 9 with_mysql8 modules. wait_mysql8_to_start connects as root (helpers/config_cluster.py:2) to the container's network address (helpers/cluster.py:2908, via get_instance_ip), not over localhost. Error 1130 is issued before authentication, so that connection can only succeed if root@'%' exists, and the fixture raises when it does not. On the rebuilt image the entrypoint's command -v guard (line 167) skips the cert step, so reaching docker_setup_db is the only way those modules can pass. ci/defs/defs.py:207-212 makes clickhouse/test-mysql80 a rebuild target of this Dockerfile, Dockers Build (amd, arm, multiplatform) passed here, and 6 integration shards are running against that rebuilt image on this commit now. So this is not "only if the upstream helper happens to fail again".
What those suites genuinely cannot catch is a future re-introduction of the binary. The proposed test would not close that gap either.
The test as described is not constructible here. Fault-injecting mysql_ssl_rsa_setup requires building or mutating an image. Integration tests only pull images by tag (helpers/cluster.py:3634, tag from integration_tests_configs.py:131); image builds live in the separate Dockers Build job. There is no docker build, docker commit or images.build anywhere under tests/integration/.
Even with a mutant image, the red arm is observable only once. The datadir is a bind mount (helpers/cluster.py:1464), so after the first run [ -d "$DATADIR/mysql" ] sets DATABASE_ALREADY_EXISTS (entrypoint 190-193) and _main skips the whole init block including the grant (352-358), permanently. The red arm's only observable outcome is the 180 s fixture timeout and its module-wide victim failures, which is the exact shape this PR removes.
Precedent: #96252, the previous fix for this same symptom on this same image, shipped compose and cert changes with no tests.
The diagnostics half is not manual-only either: it was tested both directions with a stubbed pymysql.connect raising the 1130 error (pre-fix 0 ERROR records, post-fix 1 record carrying the 1130 text).
I am not adding an "assert the binary is absent" test, because the waiter already gates the behaviour and such a test would pin the implementation rather than the outcome. I will add one if a reviewer prefers an explicit re-introduction guard.
CI finish ledger - c20a047CI is fully finished and there are no failures to own.
174 check-runs: 37 success, 137 skipped, 0 queued/in_progress. Moving to review. Session id: cron:our-pr-ci-monitor:20260802-053000 |
Related: #96252
Related: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112338&sha=6d6f6157b52d0580f7b793af3a6beec106675102&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%201%2F6%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Integration modules using
with_mysql8=Truesporadically fail their whole module withException: Cannot wait MySQL 8 container. Seen on 6 unrelated PRs over the last 90 days(0 on master), across 4 job flavours including
arm_binary, most recently 2026-07-30.The container's entrypoint runs
mysql_ssl_rsa_setupunderset -e, after the datadirbootstrap but before the step that applies the
MYSQL_ROOT_HOST=%grant. If that call exitsnon-zero the entrypoint aborts,
restart: alwaysrelaunches the container, and the second runfinds an initialized datadir and skips the whole init block, so the grant never runs. The server
then comes up healthy knowing only
root@localhost, and every connection from the docker gatewayis refused with MySQL error 1130. That error precedes authentication and is permanent, so
wait_mysql8_to_startcannot recover and burns its full 180 s budget. In the linked report thewaiter logged 342 such refusals while the server had been ready for 171 s.
This finishes what #96252 started. That PR pre-generated all 11 cert/key files and disabled
server-side RSA generation, but left the entrypoint-side generator in place. It is dead work
here: every SSL/RSA path the server uses points at the bind-mounted
/etc/mysql/certs/, and thefiles this tool writes into the datadir are read by nothing. Removing it makes the entrypoint's
own
command -vguard skip the step, so initialization reaches the grant.Verified by injecting a failing
mysql_ssl_rsa_setup: with it present,RestartCount=1andonly
root@localhost; with the same binary removed,RestartCount=0androot@%present andthe waiter succeeds. 6
with_mysql8modules show an identical failure set before and after.I also made
wait_mysql8_to_startreport the errors it collects, matching the other three MySQLwaiters. It was the only one discarding them, which is why this went undiagnosed for so long.