{"record":{"id":"44b70a0c4a032a67","repo":"quickwit-oss/tantivy","slug":"managed-directory-wlock-poisoned-2","errorCode":null,"errorMessage":"Managed directory wlock poisoned (2).","messagePattern":"Managed directory wlock poisoned \\(2\\)\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/directory/managed_directory.rs","lineNumber":187,"sourceCode":"                            failed_to_delete_files.push(file_to_delete.clone());\n                            if !cfg!(target_os = \"windows\") {\n                                // On windows, delete is expected to fail if the file\n                                // is mmapped.\n                                error!(\"Failed to delete {file_to_delete:?}\");\n                            }\n                        }\n                    }\n                }\n            }\n        }\n\n        if !deleted_files.is_empty() {\n            // update the list of managed files by removing\n            // the file that were removed.\n            let mut meta_informations_wlock = self\n                .meta_informations\n                .write()\n                .expect(\"Managed directory wlock poisoned (2).\");\n            let managed_paths_write = &mut meta_informations_wlock.managed_paths;\n            for delete_file in &deleted_files {\n                managed_paths_write.remove(delete_file);\n            }\n            self.directory.sync_directory()?;\n            save_managed_paths(self.directory.as_mut(), &meta_informations_wlock)?;\n        }\n\n        Ok(GarbageCollectionResult {\n            deleted_files,\n            failed_to_delete_files,\n        })\n    }\n\n    /// Registers a file as managed\n    ///\n    /// This method must be called before the file is\n    /// actually created to ensure that a failure between","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/quickwit-oss/tantivy/blob/b5d8deb80c26924e6b007a5b1a7630f35ca64de4/src/directory/managed_directory.rs#L169-L205","documentation":"Fires in garbage_collect after deleting stale files, when re-acquiring the write lock on meta_informations to remove the deleted paths from the managed-file set. The lock is poisoned because some thread panicked while holding it, so the on-disk .managed.json state and the in-memory set may diverge. It is a poisoned-lock sentinel rather than an input validation error; the '(2)' distinguishes this second lock acquisition in the same method from the earlier read-lock panic.","triggerScenarios":"Thrown at src/directory/managed_directory.rs:187 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the underlying panic that poisoned the meta_informations RwLock","Ensure save_managed_paths/sync_directory errors are propagated as Result instead of panicking under the lock","Re-run garbage collection after recovery so managed_paths is reconciled with deleted files"],"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"}