#8369·turso

死锁: 同步引擎在 await 中持有 blocking parking_lot:: Mutex; 并发的 connect()/push() 会在每个 tokio 工作进程中阻塞

作者: leshec创建于 2026年8月13日更新于 2026年9月16日
标签sync
  1. The coroutines built in turso_sync_sdk_kit/src/rsapi.rs open with sync_engine.lock_arc() — a blocking parking_lot::Mutex — and hold the guard across their .await, which for a push is the whole network round-trip. Six methods do this: connect (line 424), stats (447), checkpoint (464), push_changes (481), wait_changes (497), apply_changes (519).
  2. TursoDatabaseAsyncOperation::resume() drives a genawaiter::sync::Gen — a synchronous generator — so the coroutine body runs inline on whichever thread polls it (AsyncOpFuture::poll in turso/src/sync.rs calls resume()).
  3. So a push takes the mutex, hits network IO, returns Pending, and releases its thread with the mutex still held. Every other engine call then parks a tokio worker thread inside lock_arc(). Once all workers are parked, nobody is left to poll the push, its IO is never consumed, and the mutex is never released.

内容来源: tursodatabase/turso