Skip to content

Fix segfault#95

Closed
pamarcos wants to merge 1 commit intomasterfrom
fix-segfault
Closed

Fix segfault#95
pamarcos wants to merge 1 commit intomasterfrom
fix-segfault

Conversation

@pamarcos
Copy link
Copy Markdown
Member

It happened when upgrading 25.10 to 25.12:
https://github.com/ClickHouse/clickhouse-core-incidents/issues/1479

It happened when upgrading 25.10 to 25.12:
ClickHouse/clickhouse-core-incidents#1479
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a segfault observed during the 25.10 → 25.12 upgrade by hardening snapshot-related code paths against null snapshot pointers.

Changes:

  • Prevent null dereference in fatal snapshot-sync error logging (handle_snapshot_sync.cxx).
  • Prevent null dereference when compacting logs after snapshot completion (handle_commit.cxx).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/handle_snapshot_sync.cxx Guards an error-log expression to avoid dereferencing a null snapshot pointer.
src/handle_commit.cxx Adds a null check before using state_machine_->last_snapshot() during post-snapshot compaction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -722,7 +722,8 @@ void raft_server::on_snapshot_completed
ptr<snapshot> new_snp = state_machine_->last_snapshot();
set_last_snapshot(new_snp);
Comment on lines +725 to 727
if ( new_snp &&
new_snp->get_last_log_idx() >
(ulong)params->reserved_log_items_ ) {
@pamarcos pamarcos requested a review from antonio2368 March 18, 2026 13:33
@pamarcos
Copy link
Copy Markdown
Member Author

Closing in favor of #96

@pamarcos pamarcos closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants