{"record":{"id":"70f62d81686552c9","repo":"gitui-org/gitui","slug":"set-err","errorCode":null,"errorMessage":"set err","messagePattern":"set err","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/notify_mutex.rs","lineNumber":37,"sourceCode":"\t\t\tdata: Arc::new((Mutex::new(start_value), Condvar::new())),\n\t\t}\n\t}\n\n\t///\n\tpub fn wait(&self, condition: T)\n\twhere\n\t\tT: PartialEq + Copy,\n\t{\n\t\tlet mut data = self.data.0.lock().expect(\"lock err\");\n\t\twhile *data != condition {\n\t\t\tdata = self.data.1.wait(data).expect(\"wait err\");\n\t\t}\n\t\tdrop(data);\n\t}\n\n\t///\n\tpub fn set_and_notify(&self, value: T) {\n\t\t*self.data.0.lock().expect(\"set err\") = value;\n\t\tself.data.1.notify_one();\n\t}\n\n\t///\n\tpub fn get(&self) -> T\n\twhere\n\t\tT: Copy,\n\t{\n\t\t*self.data.0.lock().expect(\"get err\")\n\t}\n}\n","sourceCodeStart":19,"sourceCodeEnd":49,"githubUrl":"https://github.com/gitui-org/gitui/blob/2fa693cb6ed431b21ebc300dd02e83c2476699ce/src/notify_mutex.rs#L19-L49","documentation":"set_and_notify() locks the Notify's mutex to store the value; the expect(\"set err\") fires only when that mutex is poisoned - a prior panic occurred on a thread holding it. The failed set means a waiter never gets notified, so threads blocked in wait() also stall or die; again a secondary symptom.","triggerScenarios":"A producer thread calling set_and_notify() after another thread panicked while holding the mutex; teardown ordering where a panicked worker leaves the lock poisoned and the event loop then tries to publish state.","commonSituations":"Crash cascades in older builds; debugging sessions where a breakpoint/panic in a critical section leaves shared state locked.","solutions":["Diagnose the original panic from the log, not this one.","Restart the process to clear the poisoned state after fixing the root cause.","In your own code, move panicking operations outside locked regions and prefer non-poisoning mutexes (parking_lot)."],"exampleFix":"// before\n*self.data.0.lock().expect(\"set err\") = value;\n// after\n*self.data.0.lock().unwrap_or_else(|poisoned| poisoned.into_inner()) = value;","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"*m.lock().unwrap_or_else(|poisoned| poisoned.into_inner()) = value;\ncv.notify_one();","preventionTips":["Move panicking operations (unwraps, expects) out of locked regions.","Consider recover-from-poison semantics for state that is written wholesale.","After any panic in a multithreaded session, restart rather than trusting shared state."],"tags":["mutex","poisoning","panic","concurrency","notify"],"backgroundTag":"mutex-poisoned","analyzedSha":"2fa693cb6ed431b21ebc300dd02e83c2476699ce","analyzedAt":"2026-08-16T23:07:36.562Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}