Skip to content

Cherry-pick delta-io/delta-kernel-rs#3202 onto v0.23.0: avoid tokio blocking pool handoff deadlock - #19

Merged
alexey-milovidov merged 1 commit into
ClickHouse:ClickHouse/v0.23.0from
xenx96:cherry-pick-3202-v0.23.0
Nov 8, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:ClickHouse/v0.23.0from
xenx96:cherry-pick-3202-v0.23.0

Conversation

@xenx96

@xenx96 xenx96 commented Oct 28, 2026 •

Copy link
Copy Markdown

Cherry-pick of delta-io#3202 ("fix: avoid tokio blocking pool handoff deadlock") onto ClickHouse/v0.23.0, the branch ClickHouse master pins (88ff5a94).

TokioBackgroundExecutor::block_on and TokioMultiThreadExecutor::block_on hand the task's result back through tokio::task::spawn_blocking. When that thread cannot be spawned, tokio panics and the closure holding the std::sync::mpsc::Sender stays queued, so the caller's recv() waits forever. In ClickHouse this left a DDLWorker blocked in a DeltaLake CREATE TABLE for 26 hours after the server hit its pod PID limit (ClickHouse/ClickHouse#128033). The upstream fix sends the result directly from the async task (Sender::send never waits).

The change is identical to upstream; only the path differs (kernel/src/engine/default/executor.rs on this branch). It includes the upstream regression test test_owned_runtime_small_blocking_pool_completes_many_block_on_calls, which replaces the test that asserted the deadlock.

Testing

The crate's own lib tests do not compile on this branch, independently of this change (kernel/src/parallel/parallel_phase.rs: visit_scan_files callbacks return () where bool is expected). So I ran the upstream regression scenario from a separate crate that depends on this branch's delta_kernel (default-engine-rustls, arrow):

The scenario is upstream's: a multi-thread runtime with max_blocking_threads(1), eight spawn_blocking tasks each calling block_on, and the results collected with a timeout. A 20 s watchdog ends the process, because without the fix the outer block_on's own handoff is stranded as well and its recv() has no timeout.

delta_kernel Result
ClickHouse/v0.23.0 (88ff5a94) stalls; the watchdog ends it after 20 s (exit 101)
this branch (094210b5) passes at once (exit 0)

For the 26.3 line see the companion PR against ClickHouse/v0.19.2-with-panic-safe-ffi: #20

Cherry-pick of delta-io#3202 onto ClickHouse/v0.23.0. The file lives at
kernel/src/engine/default/executor.rs on this branch; the change is otherwise identical.

(cherry picked from commit b69ebcf)
@CLAassistant

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 sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@alexey-milovidov
alexey-milovidov merged commit 86762ee into ClickHouse:ClickHouse/v0.23.0 Nov 8, 2026
9 of 26 checks passed
middas-0706 pushed a commit to middas-0706/ClickHouse that referenced this pull request Nov 12, 2026
…wned

delta-kernel's `block_on` handed the task result back through
`tokio::task::spawn_blocking`. When the process could not create a thread, that
call panicked after queueing the closure that owns the result sender, so the
sender was never dropped and the caller's `recv()` waited forever (the query
ignored KILL QUERY). The fix sends the result directly from the async task.

The new pin is the merge commit of ClickHouse/delta-kernel-rs#19, a cherry-pick
of delta-io/delta-kernel-rs#3202 onto `ClickHouse/v0.23.0`. It changes only
`kernel/src/engine/default/executor.rs`; no Cargo manifest or lock change.

Closes ClickHouse#128033

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

4 participants