{"record":{"id":"3a99e76086d5402e","repo":"quickwit-oss/tantivy","slug":"mmap-cache-lock-is-poisoned","errorCode":null,"errorMessage":"mmap cache lock is poisoned","messagePattern":"mmap cache lock is poisoned","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/directory/mmap_directory/mod.rs","lineNumber":296,"sourceCode":"        Ok(MmapDirectory::new(canonical_path, None))\n    }\n\n    /// Joins a relative_path to the directory `root_path`\n    /// to create a proper complete `filepath`.\n    fn resolve_path(&self, relative_path: &Path) -> PathBuf {\n        self.inner.root_path.join(relative_path)\n    }\n\n    /// Returns some statistical information\n    /// about the Mmap cache.\n    ///\n    /// The `MmapDirectory` embeds a `MmapDirectory`\n    /// to avoid multiplying the `mmap` system calls.\n    pub fn get_cache_info(&self) -> CacheInfo {\n        self.inner\n            .mmap_cache\n            .write()\n            .expect(\"mmap cache lock is poisoned\")\n            .remove_weak_ref();\n        self.inner\n            .mmap_cache\n            .read()\n            .expect(\"Mmap cache lock is poisoned.\")\n            .get_info()\n    }\n}\n\n/// We rely on fs2 for file locking. On Windows & MacOS this\n/// uses BSD locks (`flock`). The lock is actually released when\n/// the `File` object is dropped and its associated file descriptor\n/// is closed.\nstruct ReleaseLockFile {\n    _file: File,\n    path: PathBuf,\n}\n","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/quickwit-oss/tantivy/blob/b5d8deb80c26924e6b007a5b1a7630f35ca64de4/src/directory/mmap_directory/mod.rs#L278-L314","documentation":"Fires in MmapDirectory::get_cache_info when taking the write lock on the mmap cache to prune dead weak references. The RwLock is poisoned — some thread panicked while holding it — so cache statistics cannot be safely computed. This is a poisoned-lock sentinel rather than a data validation failure; note the follow-up read() on the same lock carries a similar message, so either acquisition can surface this failure in cache introspection.","triggerScenarios":"Thrown at src/directory/mmap_directory/mod.rs:296 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Find the original panic that poisoned the mmap_cache lock (review logs from the crashing thread)","Avoid panicking while holding the cache lock; propagate errors as Results","Recover with PoisonError::into_inner if best-effort cache info is acceptable"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b5d8deb80c26924e6b007a5b1a7630f35ca64de4","analyzedAt":"2026-09-05T13:20:51.521Z","contentChangedAt":"2026-09-05T13:20:51.521Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}