{"record":{"id":"bb9acc460c38b14c","repo":"zellij-org/zellij","slug":"failed-to-spawn-forward-timeout-driver-thread","errorCode":null,"errorMessage":"failed to spawn forward-timeout driver thread","messagePattern":"failed to spawn forward-timeout driver thread","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"zellij-client/src/stdin_ansi_parser.rs","lineNumber":923,"sourceCode":"static FORWARD_TIMEOUT_RUNTIME: OnceLock<Arc<tokio::runtime::Runtime>> = OnceLock::new();\n\npub fn forward_timeout_runtime() -> &'static Arc<tokio::runtime::Runtime> {\n    FORWARD_TIMEOUT_RUNTIME.get_or_init(|| {\n        let rt = tokio::runtime::Builder::new_current_thread()\n            .enable_time()\n            .build()\n            .expect(\"failed to build forward-timeout runtime\");\n        let rt = Arc::new(rt);\n        let rt_for_driver = rt.clone();\n        // `block_on(pending())` keeps the executor loop alive forever\n        // on this thread; spawned timer tasks are polled as they\n        // become ready (on spawn, on wake from the time driver).\n        std::thread::Builder::new()\n            .name(\"zellij-client-forward-timeout\".into())\n            .spawn(move || {\n                rt_for_driver.block_on(std::future::pending::<()>());\n            })\n            .expect(\"failed to spawn forward-timeout driver thread\");\n        rt\n    })\n}\n\n/// Spawn a timer task that closes a forward slot after `deadline` and\n/// invokes `on_timeout(token, reply_bytes)` with whatever the slot\n/// accumulated. Token-guard idempotent: if the barrier (or a\n/// replacement forward) has already cleared the slot by the time the\n/// timer wakes, `close_forward_on_timeout(token)` returns `None` and\n/// `on_timeout` is never called — no explicit cancellation path\n/// required.\n///\n/// Extracted as a free function so tests can drive it against a\n/// `tokio::time::pause()`-backed paused runtime without instantiating\n/// the full client.\npub fn schedule_forward_timeout<F>(\n    runtime: &tokio::runtime::Handle,\n    parser: Arc<Mutex<StdinAnsiParser>>,","sourceCodeStart":905,"sourceCodeEnd":941,"githubUrl":"https://github.com/zellij-org/zellij/blob/e839bfffa586992364309a685b2c71f3b23c247e/zellij-client/src/stdin_ansi_parser.rs#L905-L941","documentation":"Error \"failed to spawn forward-timeout driver thread\" thrown in zellij-org/zellij.","triggerScenarios":"Occurs at zellij-client/src/stdin_ansi_parser.rs:914 when the operation fails: \"failed to spawn forward-timeout driver thread\". Currently there is no defensive handling preventing or contextualizing this failure before it surfaces.","commonSituations":"Typically resource exhaustion, invalid fd state, or platform-specific pty limitations.","solutions":["Check system resource limits (open files, processes) and the OS error attached to the failure.","Retry the operation; if persistent, report the OS error with a zellij issue."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e839bfffa586992364309a685b2c71f3b23c247e","analyzedAt":"2026-08-19T07:42:58.758Z","contentChangedAt":"2026-08-19T07:42:58.758Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}