{"record":{"id":"a5a9eaf8cd4e8ad8","repo":"zed-industries/zed","slug":"atomics-store-failed","errorCode":null,"errorMessage":"Atomics.store failed","messagePattern":"Atomics\\.store failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/dispatcher.rs","lineNumber":108,"sourceCode":"    }\n\n    fn signal_view(&self) -> js_sys::Int32Array {\n        let byte_offset = self.signal.as_ptr() as u32;\n        let memory = js_sys::WebAssembly::Memory::from(wasm_bindgen::memory());\n        js_sys::Int32Array::new_with_byte_offset_and_length(&memory.buffer(), byte_offset, 1)\n    }\n\n    fn run_waker_loop(self: &Arc<Self>, window: web_sys::Window) {\n        if !shared_memory_supported() {\n            log::warn!(\"SharedArrayBuffer not available; main thread mailbox waker loop disabled\");\n            return;\n        }\n\n        let mailbox = Arc::clone(self);\n        wasm_bindgen_futures::spawn_local(async move {\n            let view = mailbox.signal_view();\n            loop {\n                js_sys::Atomics::store(&view, 0, 0).expect(\"Atomics.store failed\");\n\n                // Items posted between the previous drain and the store above\n                // set the signal we just cleared, so their notify is lost.\n                // Drain again after re-arming to avoid missing them.\n                mailbox.drain(&window);\n\n                let result = match js_sys::Atomics::wait_async(&view, 0, 0) {\n                    Ok(result) => result,\n                    Err(error) => {\n                        log::error!(\"Atomics.waitAsync failed: {error:?}\");\n                        break;\n                    }\n                };\n\n                let is_async = js_sys::Reflect::get(&result, &JsValue::from_str(\"async\"))\n                    .ok()\n                    .and_then(|v| v.as_bool())\n                    .unwrap_or(false);","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui_web/src/dispatcher.rs#L90-L126","documentation":"In the web dispatcher's waker loop, an Atomics.store on shared memory failed — either SharedArrayBuffer semantics were violated (non-shared buffer, out-of-bounds index) or the environment changed between the capability check and use. Waking the main-thread mailbox will not work, so this signals a broken cross-thread wakeup path.","triggerScenarios":"Thrown at crates/gpui_web/src/dispatcher.rs:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the buffer is a genuine SharedArrayBuffer and the index is in range","Re-check shared_memory_supported() at use time, not only at loop start","Ensure COOP/COEP headers keep SharedArrayBuffer available for the page","Log and degrade to non-shared-memory wakeup if atomics fail"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}