Skip to content

Commit 4c5df16

Browse files
committed
f - Explain eager handoff runtime mitigation
Document why Tokio eager driver handoff only narrows the block_on deadlock risk and why StoreRuntime remains necessary until fully async APIs remove the blocking bridge. Co-Authored-By: HAL 9000
1 parent caf5765 commit 4c5df16

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/runtime.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ impl Runtime {
3434
Err(_) => {
3535
let mut runtime_builder = tokio::runtime::Builder::new_multi_thread();
3636
runtime_builder.enable_all();
37+
// Eager driver handoff lets Tokio move the I/O driver to another worker sooner
38+
// when this runtime's current worker enters `block_in_place` via `block_on`.
39+
// That marginally reduces the chance that a synchronous caller blocks the same
40+
// worker that would otherwise drive the I/O resource it is waiting on. It does
41+
// not solve the issue completely: it only applies to node runtimes we build
42+
// ourselves under `tokio_unstable`, does not affect externally supplied runtime
43+
// handles, and cannot guarantee that every persistence driver task needed by the
44+
// blocked future is already polling elsewhere. See the `StoreRuntime` docs below
45+
// for the full deadlock scenario and the temporary store-runtime isolation.
3746
#[cfg(tokio_unstable)]
3847
runtime_builder.enable_eager_driver_handoff();
3948
let rt = runtime_builder.build()?;

0 commit comments

Comments
 (0)