Repository navigation
Fix flaky test_tcp_handler_connection_limits - #113530
Merged
Merged
Conversation
The test counted every `Done processing connection.` message in the server log
and asserted that its own connection was the only one that closed. Two
unrelated connections break that count:
* The readiness probe of `cluster.start` connects to the TCP port and closes it
without sending any data. The port is bound and listening from `createServers`
onwards, so the kernel completes the handshake long before the server starts
accepting; the probe is served only once startup finishes, which can be after
the test has already sampled the initial count. This is what fails on MSan,
where startup takes seconds:
Application: Ready for connections.
TCPHandlerFactory: TCP Request. Address: 172.16.2.1:59612
TCPHandler: Client has not sent any data.
TCPHandler: Done processing connection. <-- counted, but not sampled
* `clickhouse-client` reconnects after the server drops it, so a single run of
the test can close two connections by itself. That is the shape of the earlier
failures, where both tests reported a delta of two.
Count the connections closed *because a limit was reached* instead - the server
logs `Closing connection due to limits` exactly once per such connection, and
the reason distinguishes the query-count limit from the time limit. Neither the
readiness probe nor a reconnecting client reaches a limit: `query_count` and
`connection_timer` are per-connection, so a fresh connection starts from zero.
With the count no longer polluted by startup connections, the `sleep` that tried
to wait them out is not needed.
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=7d22d13ab50ff1474fad83ba8e19db7b60c24412&name_0=MasterCI&name_1=Integration%20tests%20%28amd_msan%2C%203%2F8%29
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [0e8920b] Summary: ✅ AI ReviewSummaryThis PR hardens Final Verdict✅ No blocking review findings. No new inline comments were posted. |
`cluster.start` returns as soon as the TCP handshake to the port succeeds, which the kernel completes while the server may still be starting up, so a test's connection can sit in the accept backlog behind the rest of the startup. Waiting for one query to go through is the condition the removed `sleep` was guessing at. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This was referenced Aug 6, 2026
Pre-size the offsets in
ColumnArray::insertManyDefaults and ColumnString::insertManyDefaults
#113577
Merged
This was referenced Aug 6, 2026
1 task done
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.
test_tcp_handler_connection_limitscounted everyDone processing connection.message in the server log and asserted that its own connection was the only one that closed. Two unrelated connections break that count.The readiness probe of
cluster.startconnects to the TCP port and closes it without sending any data. The port is bound and listening fromcreateServersonwards, so the kernel completes the handshake long before the server starts accepting; the probe is served only once startup finishes, which can be after the test has already sampled the initial count. That is the MSan failure, where startup takes seconds:Also,
clickhouse-clientreconnects after the server drops it, so a single run of the test can close two connections by itself. That is the shape of the earlier failures, where both tests reported a delta of two.Count the connections closed because a limit was reached instead - the server logs
Closing connection due to limitsexactly once per such connection, and the reason distinguishes the query-count limit from the time limit. Neither the readiness probe nor a reconnecting client reaches a limit:query_countandconnection_timerare per-connection, so a fresh connection starts from zero. With the count no longer polluted by startup connections, thesleepthat tried to wait them out is not needed.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=7d22d13ab50ff1474fad83ba8e19db7b60c24412&name_0=MasterCI&name_1=Integration%20tests%20%28amd_msan%2C%203%2F8%29
Changelog category (leave one):