Skip to content

Prevent server termination when unregistering S3 client fails - #101798

Merged
CheSema merged 8 commits into
ClickHouse:masterfrom
gagandhakrey:fix/s3-client-destructor-crash-fix
Apr 10, 2026
Merged

CheSema merged 8 commits into
ClickHouse:masterfrom
gagandhakrey:fix/s3-client-destructor-crash-fix

Conversation

@gagandhakrey

@gagandhakrey gagandhakrey commented Apr 5, 2026 •

Copy link
Copy Markdown
Contributor

Linked issues

Prevents the server from terminating (std::terminate) when an exception is thrown during S3 client cache unregistration. The throw; statement was erroneously placed within the catch block of Client::~Client(), which is a noexcept destructor.

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):

Fix exception escaping from S3 Client::~Client destructor causing server termination.

StackOverflow similar issue link: https://stackoverflow.com/questions/40455741/why-c11-mark-destructors-as-nothrow-and-is-it-possible-to-override-it?#:~:text=Destructors%20are%20called,override%20the%20default.
...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.814
  • Backported to: 26.3.7.8, 26.2.11.5, 26.1.8.35, 25.8.24.10

@gagandhakrey

gagandhakrey commented Apr 5, 2026 •

Copy link
Copy Markdown
Contributor Author

@CLAassistant

CLAassistant commented Apr 5, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
3 out of 4 committers have signed the CLA.

✅ CheSema
✅ gagandhakrey
✅ alexey-milovidov
❌ Gagan Dhakrey


Gagan Dhakrey seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@alexey-milovidov
alexey-milovidov requested a review from CheSema April 5, 2026 04:20
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Apr 5, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

Let's check with @CheSema, maybe the intent was to call std::terminate.

@clickhouse-gh

clickhouse-gh Bot commented Apr 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0cd525a]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_msan, WasmEdge, parallel, 1/2) failure
02843_context_has_expired FAIL cidb
Finish Workflow failure
python3 ./ci/jobs/scripts/workflow_hooks/new_tests_check.py failure

AI Review

Summary

This PR removes a throw; from S3::Client::~Client after logging an exception from ClientCacheRegistry::unregisterClient. That is the correct fix: allowing exceptions to escape a destructor can trigger std::terminate, so swallowing-and-logging here improves robustness without changing normal behavior. I did not find correctness, safety, performance, or compatibility regressions in this diff.

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

@alexey-milovidov alexey-milovidov added the close in a month if not active This will be closed in case of no information label Apr 6, 2026
@CheSema CheSema self-assigned this Apr 9, 2026

@CheSema CheSema left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, it was not intentionally. It is mistake.

@CheSema

CheSema commented Apr 9, 2026

Copy link
Copy Markdown
Member

CI did not pass because there were no changelog category in description. I will retrigger it

@clickhouse-gh clickhouse-gh Bot added pr-critical-bugfix pr-must-backport Pull request should be backported intentionally. Use this label with great care! labels Apr 9, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

The test_database_iceberg_nessie_catalog and test_database_iceberg_lakekeeper_catalog failures in this PR's CI are false positives caused by a bug in PR #100583 (merged to master on 2026-04-09 at 11:19 UTC). That PR broke the metadata file path resolution in getMetadataLocation for Iceberg catalog tests — it produced a doubled S3 key like table_path/warehouse-rest/table_path/metadata/... instead of table_path/metadata/..., causing MinIO to return 403.

The bug was reverted by PR #102247 (merged at ~14:48 UTC). All nessie/lakekeeper test failures between these two merges are unrelated to this PR.

@clickhouse-gh

clickhouse-gh Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.00% 84.00% +0.00%
Functions 90.90% 90.90% +0.00%
Branches 76.50% 76.50% +0.00%

Changed lines: 60.00% (3/5) · Uncovered code

Full report · Diff report

@CheSema
CheSema added this pull request to the merge queue Apr 10, 2026
Merged via the queue into ClickHouse:master with commit fd4ff46 Apr 10, 2026
160 of 163 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 10, 2026
@robot-clickhouse robot-clickhouse added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Apr 10, 2026
robot-clickhouse added a commit that referenced this pull request Apr 10, 2026
robot-clickhouse added a commit that referenced this pull request Apr 10, 2026
robot-clickhouse added a commit that referenced this pull request Apr 10, 2026
robot-clickhouse added a commit that referenced this pull request Apr 10, 2026
@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 Apr 10, 2026
clickhouse-gh Bot added a commit that referenced this pull request Apr 11, 2026
Backport #101798 to 26.1: Prevent server termination when unregistering S3 client fails
clickhouse-gh Bot added a commit that referenced this pull request Apr 11, 2026
Backport #101798 to 26.2: Prevent server termination when unregistering S3 client fails
clickhouse-gh Bot added a commit that referenced this pull request Apr 11, 2026
Backport #101798 to 26.3: Prevent server termination when unregistering S3 client fails
fm4v added a commit that referenced this pull request May 13, 2026
Backport #101798 to 25.8: Prevent server termination when unregistering S3 client fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors close in a month if not active This will be closed in case of no information 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants