Repository navigation
Fix DeltaLake delta-kernel-rs FFI server crash and builder leak - #106109
Merged
Algunenano merged 3 commits intoMay 30, 2026
Merged
Algunenano merged 3 commits into
Algunenano merged 3 commits into
Conversation
Two Rust panics could cross the `extern "C"` boundary and abort the server (issue ClickHouse#104509): `set_builder_option` called `.unwrap()` on invalid UTF-8, and a panic deep inside `snapshot` (for example `object_store` rejecting a credential that is valid UTF-8 but an invalid HTTP header value) reached `panic_cannot_unwind`. Bump the `delta-kernel-rs` fork so `set_builder_option` returns an error instead of panicking, add `free_engine_builder`, and guard `snapshot` and `builder_build` with `catch_unwind`. On the C++ side route option setting through `KernelUtils::unwrapResult` and free the builder with a RAII guard on the error path, which also fixes the leak introduced by the reverted PR ClickHouse#105897. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Without this, an option value that is not valid UTF-8 (such as a binary SAS token) surfaces as an opaque `DELTA_KERNEL_ERROR` with the raw Rust `Utf8Error` wording. Validate the value in `setBuilderOption` and reject it with `BAD_ARGUMENTS` naming the option. The FFI still propagates the error as defense in depth. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
|
Workflow [PR], commit [2b86d27] Summary: ✅
AI ReviewSummaryThis PR fixes Missing context / blind spots
Final VerdictStatus: ✅ Approve No required changes. |
Change Data Feed queries (`delta_lake_snapshot_start_version`) enter `ffi::table_changes_from_version` without first building a guarded snapshot, so the same invalid-credential panic still crossed the `extern "C"` boundary and aborted the server. Bump the `delta-kernel-rs` fork to wrap the table-changes FFI exports in `catch_unwind`, and add a CDF regression test. Co-Authored-By: Claude Opus 4.8 <[email protected]>
kssenii
approved these changes
May 29, 2026
Contributor
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 32/32 (100.00%) | Lost baseline coverage: none · Uncovered code |
Algunenano
enabled auto-merge
May 30, 2026 11:39
Merged
via the queue into
ClickHouse:master
with commit May 30, 2026
9d6d493
166 of 167 checks passed
This was referenced May 30, 2026
Cherry pick #106109 to 25.8: Fix DeltaLake delta-kernel-rs FFI server crash and builder leak
#106155
Closed
Cherry pick #106109 to 26.3: Fix DeltaLake delta-kernel-rs FFI server crash and builder leak
#106156
Merged
Cherry pick #106109 to 26.4: Fix DeltaLake delta-kernel-rs FFI server crash and builder leak
#106157
Merged
robot-ch-test-poll4
added a commit
that referenced
this pull request
May 30, 2026
Cherry pick #106109 to 26.5: Fix DeltaLake delta-kernel-rs FFI server crash and builder leak
robot-clickhouse
added a commit
that referenced
this pull request
May 30, 2026
…ash and builder leak
Algunenano
added a commit
that referenced
this pull request
May 30, 2026
Backport #106109 to 26.5: Fix DeltaLake delta-kernel-rs FFI server crash and builder leak
robot-clickhouse-ci-1
added a commit
that referenced
this pull request
May 30, 2026
Cherry pick #106109 to 26.3: Fix DeltaLake delta-kernel-rs FFI server crash and builder leak
robot-clickhouse
added a commit
that referenced
this pull request
May 30, 2026
…ash and builder leak
robot-clickhouse-ci-1
added a commit
that referenced
this pull request
May 30, 2026
Cherry pick #106109 to 26.4: Fix DeltaLake delta-kernel-rs FFI server crash and builder leak
robot-clickhouse
added a commit
that referenced
this pull request
May 30, 2026
…ash and builder leak
Algunenano
added a commit
that referenced
this pull request
May 31, 2026
Backport #106109 to 26.4: Fix DeltaLake delta-kernel-rs FFI server crash and builder leak
Algunenano
added a commit
that referenced
this pull request
Jun 2, 2026
Backport #106109 to 26.3: Fix DeltaLake delta-kernel-rs FFI server crash and builder leak
leshikus
pushed a commit
to leshikus/ClickHouse
that referenced
this pull request
Jun 8, 2026
The catch_unwind guards added in ClickHouse#106109 wrap their body in an outer `unsafe` block, so the inner `unsafe` around `unwrap_and_parse_path_as_url` and `log_paths` inside the closures was redundant and emitted four `unused_unsafe` warnings on every build. Bump the delta-kernel-rs fork to drop those inner blocks. Closes ClickHouse#106223 Co-Authored-By: Claude Opus 4.8 <[email protected]>
SmitaRKulkarni
added a commit
that referenced
this pull request
Jun 18, 2026
…safety cherry-picks) Cherry-pick the FFI panic-safety and builder-leak fixes from master's delta-kernel-rs pointer onto the v0.23.0-based rebase-onto-v0.23.0 branch: ffi: make set_builder_option return an error instead of panicking ffi: add free_engine_builder to release a builder without building it ffi: guard snapshot and builder_build with catch_unwind ffi: guard table-changes (CDF) FFI exports with catch_unwind ffi: drop redundant inner unsafe blocks in catch_unwind closures These correspond to the changes introduced by #106109 and #106381, re-applied on top of the v0.23.0 rebase so this branch keeps the standalone snapshot FFI functions guarded with catch_unwind. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
… server crash and builder leak
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…6109 Backport ClickHouse#106109 to 26.4: Fix DeltaLake delta-kernel-rs FFI server crash and builder leak
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…safety cherry-picks) Cherry-pick the FFI panic-safety and builder-leak fixes from master's delta-kernel-rs pointer onto the v0.23.0-based rebase-onto-v0.23.0 branch: ffi: make set_builder_option return an error instead of panicking ffi: add free_engine_builder to release a builder without building it ffi: guard snapshot and builder_build with catch_unwind ffi: guard table-changes (CDF) FFI exports with catch_unwind ffi: drop redundant inner unsafe blocks in catch_unwind closures These correspond to the changes introduced by ClickHouse#106109 and ClickHouse#106381, re-applied on top of the v0.23.0 rebase so this branch keeps the standalone snapshot FFI functions guarded with catch_unwind. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DeltaLake queries could abort the server through a Rust panic crossing the
delta-kernel-rsextern "C"boundary (panic_in_cleanup). Two paths were affected:set_builder_optioncalled.unwrap()on option values that are not valid UTF-8 (for example a binaryMD5(...)SAS token).snapshot/ engine construction (for exampleobject_storerejecting a credential that is valid UTF-8 but an invalid HTTP header value, such as aNULbyte in an S3 access key) reachedpanic_cannot_unwind.The fix is in both Rust and C++, with better error handling at the FFI boundary. In the
delta-kernel-rsfork,set_builder_optionnow returns an error instead of panicking, a newfree_engine_builderlets the builder be released on the error path, andsnapshotandbuilder_buildare wrapped incatch_unwindso a panic deep in the kernel becomes an error. On the C++ side, option setting goes throughKernelUtils::unwrapResultand the builder is freed with a RAII guard on the error path, which also fixes the memory leak introduced by the reverted #105897.As an additional, not mandatory improvement, the C++ side also validates option values up front and rejects invalid UTF-8 with a clear
BAD_ARGUMENTSnaming the option, instead of the opaqueDELTA_KERNEL_ERROR.Closes #104509
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a server crash when querying DeltaLake tables with
allow_experimental_delta_kernel_rsenabled and a credential or option that contained invalid bytes (the Rust FFI panicked across theextern "C"boundary).Version info
26.6.1.27226.5.2.18,26.4.4.21,26.3.13.23