Skip to content

Fix possible use of expired process list entry from DatabaseReplicated in getRemoteReadThrottler() - #103387

Merged
azat merged 1 commit into
ClickHouse:masterfrom
azat:fix-expired-query-status-from-rdb
Apr 23, 2026
Merged

azat merged 1 commit into
ClickHouse:masterfrom
azat:fix-expired-query-status-from-rdb

Conversation

@azat

@azat azat commented Apr 22, 2026 •

Copy link
Copy Markdown
Member

Trottler can be called from multiple places, including DDLWorker, from ReplicatedDatabase, that calls first executeQuery() (which insert process list entry - QueryStatus, and on exit destroy it), and then calls assertDigestWithProbability(), which needs to get the metadata for the table, and throws LOGICAL_ERROR, because the weak_ptr is expired.

Backtrace: https://pastila.nl/?002a36a2/d8697e4a9a5f66199b03a2bec98c0e59#Ky1XNxVWRfAJiA2szCp9/w==GCM

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Version info

  • Merged into: 26.5.1.30

…d in getRemoteReadThrottler()

Trottler can be called from multiple places, including DDLWorker, from
ReplicatedDatabase, that calls first executeQuery() (which insert
process list entry - QueryStatus, and on exit destroy it), and then
calls assertDigestWithProbability(), which needs to get the metadata for
the table, and throws LOGICAL_ERROR, because the weak_ptr is expired.
@azat
azat requested a review from tavplubix April 22, 2026 16:32
@clickhouse-gh

clickhouse-gh Bot commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [298410d]

Summary: ❌

job_name test_name status info comment
Finish Workflow FAIL
python3 ./ci/jobs/scripts/workflow_hooks/check_report_messages.py FAIL
Unit tests (msan) ERROR

AI Review

Summary

This PR replaces getProcessListElement with getProcessListElementSafe in Context::getRemoteReadThrottler and Context::getRemoteWriteThrottler, preventing a LOGICAL_ERROR when the weak process_list_elem expires in post-query paths (e.g., replicated DB digest checks). The change is minimal, targeted, and correct; I did not find blocker or major issues.

ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Apr 22, 2026
@clickhouse-gh

clickhouse-gh Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.00% 84.00% +0.00%
Functions 91.10% 91.10% +0.00%
Branches 76.50% 76.60% +0.10%

Changed lines: 100.00% (6/6) | lost baseline coverage: 2 line(s) · Uncovered code

Full report · Diff report

@azat
azat enabled auto-merge April 22, 2026 21:16
@azat
azat added this pull request to the merge queue Apr 23, 2026
Merged via the queue into ClickHouse:master with commit bc538c8 Apr 23, 2026
158 of 161 checks passed
@azat
azat deleted the fix-expired-query-status-from-rdb branch April 23, 2026 07:30
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants