Skip to content

Fix crash in CachedOnDiskReadBufferFromFile destructor#99042

Merged
shankar-iyer merged 1 commit intoClickHouse:masterfrom
shankar-iyer:fix_crash_in_dtor
Mar 11, 2026
Merged

Fix crash in CachedOnDiskReadBufferFromFile destructor#99042
shankar-iyer merged 1 commit intoClickHouse:masterfrom
shankar-iyer:fix_crash_in_dtor

Conversation

@shankar-iyer
Copy link
Copy Markdown
Member

@shankar-iyer shankar-iyer commented Mar 9, 2026

Resolves #99037

Changelog category (leave one):

  • Critical Bug Fix (crash, data loss, RBAC)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

  • ClickHouse server process could crash if there was a memory limit exceeded exception thrown during a cached disk read. That is now fixed.

Note

Low Risk
Low risk: adds a null-check before logging in a destructor, reducing crash risk without changing read/cache behavior.

Overview
Prevents a potential crash in CachedOnDiskReadBufferFromFile::~CachedOnDiskReadBufferFromFile() by guarding filesystem cache logging with a state null-check before accessing state->read_type.

This avoids dereferencing an uninitialized read state during teardown (e.g., after exceptions) while keeping existing segment completion/cleanup logic unchanged.

Written by Cursor Bugbot for commit 39e41c4. This will update automatically on new commits. Configure here.

@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Mar 9, 2026

Workflow [PR], commit [39e41c4]

Summary:

job_name test_name status info comment
Finish Workflow failure
python3 ./ci/jobs/scripts/workflow_hooks/new_tests_check.py failure IGNORED

@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Mar 9, 2026

LLVM Coverage Report

Metric Baseline Current Δ
Lines 83.80% 83.80% +0.00%
Functions 23.90% 23.90% +0.00%
Branches 76.40% 76.40% +0.00%

PR changed lines: PR changed-lines coverage: 100.00% (5/5)
Diff coverage report
Uncovered code

@hanfei1991 hanfei1991 self-assigned this Mar 9, 2026
@kssenii kssenii self-assigned this Mar 9, 2026
@shankar-iyer shankar-iyer added this pull request to the merge queue Mar 11, 2026
Merged via the queue into ClickHouse:master with commit 587e799 Mar 11, 2026
473 of 479 checks passed
@shankar-iyer shankar-iyer deleted the fix_crash_in_dtor branch March 11, 2026 05:02
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 11, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Mar 11, 2026
robot-clickhouse added a commit that referenced this pull request Mar 11, 2026
Cherry pick #99042 to 26.2: Fix crash in CachedOnDiskReadBufferFromFile destructor
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Mar 11, 2026
clickhouse-gh bot added a commit that referenced this pull request Mar 11, 2026
Backport #99042 to 26.2: Fix crash in CachedOnDiskReadBufferFromFile destructor
@Algunenano Algunenano added pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-critical-bugfix labels Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-critical-bugfix pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.2-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segmentation fault (STID: 6336-79b2)

7 participants