{"record":{"id":"6ccb2e52eb43e28c","repo":"quickwit-oss/quickwit","slug":"stdin-cannot-be-checkpointed","errorCode":null,"errorMessage":"stdin cannot be checkpointed","messagePattern":"stdin cannot be checkpointed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-metastore/src/metastore/mod.rs","lineNumber":1516,"sourceCode":"            end: Bound::Unbounded,\n        }\n    }\n}\n\n/// Maps the given source params to whether checkpoints should be stored in the index metadata\n/// (false) or the shard table (true)\nfn use_shard_api(params: &SourceParams) -> bool {\n    match params {\n        SourceParams::File(FileSourceParams::Filepath(_)) => false,\n        SourceParams::File(FileSourceParams::Notifications(_)) => true,\n        SourceParams::Ingest => true,\n        SourceParams::IngestApi => false,\n        SourceParams::IngestCli => false,\n        SourceParams::Kafka(_) => false,\n        SourceParams::Kinesis(_) => false,\n        SourceParams::PubSub(_) => false,\n        SourceParams::Pulsar(_) => false,\n        SourceParams::Stdin => panic!(\"stdin cannot be checkpointed\"),\n        SourceParams::Vec(_) => false,\n        SourceParams::Void(_) => false,\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_filter_contains() {\n        let filter = FilterRange {\n            start: Bound::Unbounded,\n            end: Bound::Excluded(50),\n        };\n        assert!(!filter.contains(&50));\n        assert!(filter.contains(&0));\n        assert!(filter.contains(&49));","sourceCodeStart":1498,"sourceCodeEnd":1534,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-metastore/src/metastore/mod.rs#L1498-L1534","documentation":"ByteRangeCacheDirectory (the shared factory) keeps a Mutex-protected map of per-path FileByteRangeCaches. get_file_cache locks that map and `.expect`s the result. The panic occurs only when the map's mutex is poisoned — a thread previously panicked while holding this lock. The tests calling this helper would surface such a poisoning as a hard failure.","triggerScenarios":"A thread panicking while holding the `file_caches` map lock (e.g. during FileByteRangeCache construction in an earlier get_file_cache call or a panic in map insertion), then any subsequent get_file_cache call — in production code or in tests like test_byte_range_cache_is_shared_for_same_path — panics.","commonSituations":"A bug during cache creation for one path poisons the map; all later storages built on the same shared cache instance then fail; typically observed as a cascade of identical panics across threads.","solutions":["Find the initial panic that poisoned the map (first occurrence in the logs) and fix that bug.","Restart the process; poisoned mutexes never recover within a process.","Report with a backtrace of the original panic — panicking while constructing/inserting a file cache is a bug.","As a defensive code change, use `unwrap_or_else(|poisoned| poisoned.into_inner())` since map entries are individually consistent."],"exampleFix":"// before\nlet mut file_caches = self\n    .inner_arc\n    .file_caches\n    .lock()\n    .expect(\"byte range cache mutex is poisoned\");\n// after\nlet mut file_caches = self\n    .inner_arc\n    .file_caches\n    .lock()\n    .unwrap_or_else(|poisoned| poisoned.into_inner());","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// in tests: assert no panic occurred before asserting map behavior\nlet result = std::panic::catch_unwind(|| shared_cache.get_file_cache(path));\nassert!(result.is_ok(), \"file_caches mutex was poisoned by an earlier panic\");","preventionTips":["Keep FileByteRangeCache construction panic-free (no expect/assert inside the locked region).","Run cache tests with panic=abort to surface the original poisoning panic first.","In shared/global caches, prefer recover_from_poison (into_inner) semantics.","Alert on any panic in the storage cache module — all later panics are cascade effects."],"tags":["rust","mutex","concurrency","cache","storage"],"backgroundTag":"internal-invariant-violation","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}