{"record":{"id":"8155e7cf118a5540","repo":"zed-industries/zed","slug":"idle-sleep-prevention-acquisition-timed-out-after-10-seconds","errorCode":null,"errorMessage":"Idle sleep prevention acquisition timed out after 10 seconds","messagePattern":"Idle sleep prevention acquisition timed out after 10 seconds","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_linux/src/linux/platform.rs","lineNumber":1371,"sourceCode":"                    .await\n                    .context(\"Failed to release idle sleep prevention\")\n                    .log_err();\n            })\n            .detach();\n    })\n}\n\n#[cfg(any(feature = \"wayland\", feature = \"x11\"))]\nasync fn await_idle_sleep_prevention(\n    guard_rx: oneshot::Receiver<Result<ActivityGuard>>,\n    executor: &BackgroundExecutor,\n) -> Result<ActivityGuard> {\n    match futures::future::select(guard_rx, executor.timer(Duration::from_secs(10))).await {\n        futures::future::Either::Left((Ok(result), _)) => result,\n        futures::future::Either::Left((Err(_), _)) => {\n            Err(anyhow!(\"Idle sleep prevention request was abandoned\"))\n        }\n        futures::future::Either::Right(_) => Err(anyhow!(\n            \"Idle sleep prevention acquisition timed out after 10 seconds\"\n        )),\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use gpui::{Point, px};\n\n    #[cfg(any(feature = \"wayland\", feature = \"x11\"))]\n    #[test]\n    fn rejects_null_xkb_context() {\n        let context = unsafe {\n            // libxkbcommon permits unref on null, matching the value returned by Context::new on failure.\n            xkb::Context::from_raw_ptr(std::ptr::null_mut())\n        };\n        let error = validate_xkb_context(context)","sourceCodeStart":1353,"sourceCodeEnd":1389,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_linux/src/linux/platform.rs#L1353-L1389","documentation":"The Linux platform waits at most 10 seconds for the display-server backend to confirm an idle-sleep prevention request via a oneshot channel, racing it against an executor timer. If the timer wins, the request is assumed stuck and this timeout error is returned instead of an ActivityGuard.","triggerScenarios":"prevent_idle_sleep's reply arrives after 10 seconds or never: the Wayland/X11 compositor is unresponsive, the inhibiting request deadlocks, or the backend thread is blocked so the guard confirmation never arrives.","commonSituations":"Unresponsive or heavily loaded Wayland compositor/X server; a hung display-server connection (e.g. after suspend/resume or session issues); a bug in a compositor that never answers idle-inhibit requests.","solutions":["Retry the request; transient compositor stalls often resolve on a second attempt.","Verify the Wayland compositor / X server is responsive (other clients behave normally).","Reconnect the display session or restart the compositor if it is wedged.","Check for suspend/resume related connection breakage in logs and reinitialize the platform if needed."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match platform.prevent_idle_sleep(reason).await {\n    Err(e) if e.to_string().contains(\"timed out after 10 seconds\") => {\n        // check display-server health, then retry with backoff\n        ensure_display_server_alive()?;\n        platform.prevent_idle_sleep(reason).await?;\n    }\n    other => other?,\n}","preventionTips":["Ensure the Wayland compositor / X server is responsive before long-running sessions.","Investigate suspend/resume handling if timeouts cluster after wake events.","Monitor compositor health (e.g. ping the connection) in long-lived sessions.","Retry with backoff rather than hot-looping on timeout."],"tags":["linux","gpui","timeout","idle-sleep","wayland","x11"],"backgroundTag":"request-timeout","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-09-12T19:35:53.743Z","contentChangedAt":"2026-09-12T19:35:53.743Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}