{"record":{"id":"3707a8528d784f9f","repo":"gfx-rs/wgpu","slug":"could-not-lock-instance-this-is-most-likely-a-dea","errorCode":null,"errorMessage":"Could not lock instance. This is most-likely a deadlock.","messagePattern":"Could not lock instance\\. This is most-likely a deadlock\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-hal/src/gles/egl.rs","lineNumber":704,"sourceCode":"\n#[derive(Clone, Debug)]\nstruct WindowSystemInterface {\n    kind: WindowKind,\n}\n\n#[derive(Debug)]\npub struct Instance {\n    wsi: WindowSystemInterface,\n    flags: wgt::InstanceFlags,\n    options: wgt::GlBackendOptions,\n    inner: Mutex<Inner>,\n}\n\nimpl Instance {\n    pub fn raw_display(&self) -> khronos_egl::Display {\n        self.inner\n            .try_lock()\n            .expect(\"Could not lock instance. This is most-likely a deadlock.\")\n            .egl\n            .display\n    }\n\n    /// Returns the version of the EGL display.\n    pub fn egl_version(&self) -> (i32, i32) {\n        self.inner\n            .try_lock()\n            .expect(\"Could not lock instance. This is most-likely a deadlock.\")\n            .version\n    }\n}\n\n#[cfg(send_sync)]\nstatic_assertions::assert_impl_all!(Instance: Send, Sync);\n\nimpl crate::Instance for Instance {\n    type A = super::Api;","sourceCodeStart":686,"sourceCodeEnd":722,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/gles/egl.rs#L686-L722","documentation":"Panic in the GLES Instance::raw_display: try_lock on the instance mutex failed, meaning another thread holds it — the code assumes this can only happen on deadlock. The faulty input is concurrent access to the EGL instance internals.","triggerScenarios":"Thrown at wgpu-hal/src/gles/egl.rs:704 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Avoid calling raw_display/egl_version concurrently with operations holding the instance lock","Restructure threading so EGL instance access is serialized"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}