Repository navigation
Fix flaky test_server_no_logging: poll for async "Restored console logger level" line - #110033
Conversation
…gger level" line The started_cluster fixture asserted the post-startup "Restored console logger level ..." line with a one-shot contains_in_log grep immediately after cluster.start() returned. That line is emitted by LOG_INFO at the very end of server init, right before ports are opened and the instance is declared ready. Logging is async by default (logger.async=true), so the background writer thread may not have flushed that last line to the log file yet when the ping handshake succeeds, causing an intermittent AssertionError. The earlier "Starting console logger" lines pass reliably because they are logged at the start of init, giving the writer the whole init duration to flush. Use wait_for_log_line (polls up to 30s) for the two "Restored ..." checks; intent is unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-5:20260710-180100 |
|
cc @garrettthomas - could you review? Your recently-added |
|
Workflow [PR], commit [47a0bc3] Summary: ✅ AI ReviewSummaryThis PR replaces two one-shot Final VerdictStatus: ✅ Approve |
|
I love your work! |
|
Added must backport to fix flaky #109858 in releases |
…async "Restored console logger level" line
Backport #110033 to 26.6: Fix flaky test_server_no_logging: poll for async "Restored console logger level" line
Backport #110033 to 26.5: Fix flaky test_server_no_logging: poll for async "Restored console logger level" line
Backport #110033 to 26.4: Fix flaky test_server_no_logging: poll for async "Restored console logger level" line
Backport #110033 to 26.3: Fix flaky test_server_no_logging: poll for async "Restored console logger level" line
… poll for async "Restored console logger level" line
… poll for async "Restored console logger level" line
… poll for async "Restored console logger level" line
…-test_server_no_logging-async-log Fix flaky test_server_no_logging: poll for async "Restored console logger level" line
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
test_server_startup_and_shutdown_logs/test.py::test_server_no_loggingis flaky. Failure on master:CI report (master, arm_binary): https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=f5e40f2d86d1715c149223f478bce0460fdd8e29&name_0=MasterCI&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%204%2F4%29
Root cause: the
"Restored console logger level ..."line is emitted byLOG_INFOat the very end of server init (programs/server/Server.cpp), right before ports are opened and the instance is declared ready. Logging is async by default (logger.async=true), so the background writer thread may not have flushed that final line to the log file yet when the ping handshake succeeds and the fixture runs its one-shotcontains_in_loggrep. The earlier"Starting console logger in level trace"checks on the same instances pass reliably because those lines are logged at the start of init, giving the writer the whole init duration to flush.Fix: use
wait_for_log_line(polls up to 30s) for the two post-startup"Restored ..."assertions. Test intent is unchanged - the same log strings must still appear.Test-only change. The test/console-log-restore logic was added recently in dbf5f7b (fix for issue #103472); this addresses the flakiness introduced with the new fixture assertions.
Version info
26.7.1.787(included in26.7and later)26.6.2.72,26.5.6.43,26.4.5.131,26.3.17.46