Repository navigation
Fix flaky test 05346_distributed_insert_connection_buffers_freed_by_same_query - #125909
Conversation
…ame_query The test counted every MemorySample in system.trace_log with the INSERT's query_id, including samples taken under a MemoryTrackerBlockerInThread. Those are not charged to the query, but MemoryTracker still samples them with the thread's query_id. System log pushes run under such a blocker (SystemLogQueue::add). After a flush the queue vector keeps max(reserved_size_rows, rows just popped) of capacity, so a larger cycle regrows the shared vector inside whichever query pushes the overflowing row, and that query frees the old buffer, which the flush thread allocated. The oracle read it as memory the INSERT freed without allocating it. In the failing master run the only flagged pointer was a -10485760 free in SystemLogQueue<ProcessorProfileLogElement>::push from logQueryFinishImpl, with memory_blocked_context = User. Count only samples charged to the query (memory_blocked_context = 'Max'). The per-query connection buffers the test checks are charged, so the regression it guards (ConnectionPool::releaseObject not releasing them) is still caught. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261015-000200 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261014-231300 |
|
Workflow [PR], commit [1930aee] Summary: ✅ AI ReviewSummaryPR #125909 limits the allocation assertion in Final VerdictStatus: ✅ Approve |
|
cc @Algunenano, could you review this? The new 05346 oracle also counted uncharged samples taken under a |
c2f98bb
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required.
Description
Related: #125573
Failure:
Stateless tests (amd_release, parallel, 1/2)on master returned8 1instead of8 0. The test also failed on 3 unrelated PRs, 2 of them inFast test.The oracle counted every
MemorySamplewith the INSERT'squery_id, including samples taken under aMemoryTrackerBlockerInThread, which are not charged to the query. System log pushes run under such a blocker (SystemLogQueue::add). When a flush cycle is larger than the previous one, the shared queue vector regrows inside whichever query pushes the overflowing row, and that query frees the old buffer, which the flush thread or an earlier push allocated. In the failing run'strace_logthe only flagged pointer is a-10485760free inSystemLogQueue<ProcessorProfileLogElement>::pushfromlogQueryFinishImpl, withmemory_blocked_context = User.The test now counts only samples charged to the query (
memory_blocked_context = 'Max'). The per-query connection buffers it checks are charged, so it still catches the regression it was added for.Validation (debug build):
processors_profile_logqueue to just below its capacity before the test moves the regrowth into its first INSERT: the old test gives8 110/10 (same stack as CI), the new one8 010/10.ConnectionPool::releaseObjectmade a no-op, the new test still fails (8 14), with frees inConnection::resetQueryBufferscalled fromsendQuery.Workflow [PR]
Sync PR [sync-upstream/pr/125909]
Version info
26.10.1.2450-master(included in26.10and later)