Repository navigation
Fix sporadic MySQL 8 container startup failure in integration tests - #96252
Merged
Merged
Conversation
MySQL 8 sporadically fails during data directory initialization with "Could not generate RSA Private/Public key pair" in resource-constrained CI environments (ARM, container-in-container). These RSA keys are used for `sha256_password` / `caching_sha2_password` authentication plugins, which these tests don't use (`mysql_native_password` is the default). The fix provides pre-generated RSA keys to the MySQL 8 container and disables auto-generation, eliminating the sporadic failure. Failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96238&sha=856f7c28ba3cf10f393598a6f629af2af41de311&name_0=PR&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%203%2F4%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [23d9de6] Summary: ❌
|
The cluster containers (mysql2, mysql3, mysql4) use `caching_sha2_password` as the default auth plugin (they don't have `--default_authentication_plugin='mysql_native_password'`). When RSA key auto-generation was disabled without providing pre-generated keys, the `caching_sha2_password` plugin could not authenticate, causing "Access denied" for all connections. Fix: mount the pre-generated RSA keys in the cluster containers and configure the key paths, same as the mysql80 container. Also revert unrelated changes that were accidentally included in the initial commit (log_parser.py regression, .claude/ files, docs). Co-Authored-By: Claude Opus 4.6 <[email protected]>
This was referenced Jul 28, 2026
pull Bot
pushed a commit
to CrazyForks/ClickHouse
that referenced
this pull request
Aug 3, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MySQL 8 sporadically fails during data directory initialization with "Could not generate RSA Private/Public key pair" in resource-constrained CI environments (ARM, container-in-container). These RSA keys are used for
sha256_password/caching_sha2_passwordauthentication plugins, which these tests don't use (mysql_native_passwordis the default).The fix provides pre-generated RSA keys to the MySQL 8 container and disables auto-generation, eliminating the sporadic failure.
Failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96238&sha=856f7c28ba3cf10f393598a6f629af2af41de311&name_0=PR&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%203%2F4%29
#96238
Changelog category (leave one):
Version info
26.2.1.359