{"record":{"id":"eaf7de8939dba1d1","repo":"tursodatabase/turso","slug":"failed-to-build-io-runtime","errorCode":null,"errorMessage":"failed to build IO runtime","messagePattern":"failed to build IO runtime","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"bindings/rust/src/sync.rs","lineNumber":700,"sourceCode":"    ) -> Arc<Self> {\n        let (tx, rx) = mpsc::unbounded_channel::<()>();\n        let wakers = Arc::new(Mutex::new(Vec::new()));\n        let weak_sync = Arc::downgrade(&sync);\n\n        let worker = Arc::new(Self {\n            tx,\n            wakers: wakers.clone(),\n        });\n\n        // Keep the worker thread independent from the handle so dropping the\n        // last Database releases the sync engine immediately on Windows.\n        std::thread::Builder::new()\n            .name(\"turso-sync-io\".to_string())\n            .spawn(move || {\n                let rt = tokio::runtime::Builder::new_current_thread()\n                    .enable_all()\n                    .build()\n                    .expect(\"failed to build IO runtime\");\n\n                rt.block_on(async move {\n                    IoWorker::run_loop(weak_sync, base_url, auth_token, rx, wakers).await\n                });\n            })\n            .expect(\"failed to spawn IO worker thread\");\n\n        worker\n    }\n\n    // Register a waker to be awakened upon IO progress.\n    fn register(&self, waker: Waker) {\n        let mut wakers = self.wakers.lock().unwrap();\n        wakers.push(waker);\n    }\n\n    // Kick the IO worker to process IO queue.\n    fn kick(&self) {","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/tursodatabase/turso/blob/492c4a71cd7c2649e7df83da1471b74f4b1c7aa9/bindings/rust/src/sync.rs#L682-L718","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// check headroom before creating many sync Databases\nlet n = std::thread::available_parallelism().map(|n| n.get()).unwrap_or(1);\nassert!(n > 0, \"no parallelism headroom for sync IO worker\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["rust","tokio","runtime","sync","panic","resource-limits"],"backgroundTag":"runtime-initialization-failed","analyzedSha":"492c4a71cd7c2649e7df83da1471b74f4b1c7aa9","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}