tursodatabase/turso · critical
failed to build IO runtime
Error message
failed to build IO runtime
What it means
The Rust sync binding spawns a dedicated worker thread and builds a tokio current-thread runtime with enable_all for sync IO; failure to build the runtime hits .expect("failed to build IO runtime") and panics the process. Build failures mean tokio could not create its drivers or threads - an environment or resource problem, not user SQL.
Source
Thrown at bindings/rust/src/sync.rs:700
) -> Arc<Self> {
let (tx, rx) = mpsc::unbounded_channel::<()>();
let wakers = Arc::new(Mutex::new(Vec::new()));
let weak_sync = Arc::downgrade(&sync);
let worker = Arc::new(Self {
tx,
wakers: wakers.clone(),
});
// Keep the worker thread independent from the handle so dropping the
// last Database releases the sync engine immediately on Windows.
std::thread::Builder::new()
.name("turso-sync-io".to_string())
.spawn(move || {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("failed to build IO runtime");
rt.block_on(async move {
IoWorker::run_loop(weak_sync, base_url, auth_token, rx, wakers).await
});
})
.expect("failed to spawn IO worker thread");
worker
}
// Register a waker to be awakened upon IO progress.
fn register(&self, waker: Waker) {
let mut wakers = self.wakers.lock().unwrap();
wakers.push(waker);
}
// Kick the IO worker to process IO queue.
fn kick(&self) {View on GitHub (pinned to 492c4a71cd)
Solutions
- Raise thread and fd limits (ulimit -n, container pids limit) for the process
- Reduce the number of concurrently open sync Databases
- Verify the tokio features in the build include the rt and io/time drivers
- If limits are healthy and it still panics, report it - this expect path indicates a runtime-environment defect
Defensive patterns
Strategy: validation
Validate before calling
// check headroom before creating many sync Databases let n = std::thread::available_parallelism().map(|n| n.get()).unwrap_or(1); assert!(n > 0, "no parallelism headroom for sync IO worker");
Prevention
- Provision generous fd/thread limits in containers running sync workloads
- Bound the number of concurrent sync engines per process
- Verify tokio feature flags when customizing the turso build
When it happens
Trigger: Resource exhaustion at runtime creation: thread or fd limits hit inside containers, severe memory pressure, or a tokio build whose feature set lacks the io/time drivers that enable_all requires.
Common situations: cgroup nproc or ulimit ceilings in CI/containers, many concurrently open sync Databases each spawning workers, or a custom turso build with trimmed tokio features.
Related errors
- OpenRead on pseudo cursor
- Rewind on non-btree/materialized-view cursor
- unexpected cursor type
- Next on non-btree/materialized-view cursor
- failed to generate random bytes
AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-08-20).
Data as JSON: /api/errors/eaf7de8939dba1d1.
Report an issue: GitHub.