{"record":{"id":"6ac6592f2e35b4b2","repo":"rayon-rs/rayon","slug":"fifo-is-empty","errorCode":null,"errorMessage":"FIFO is empty","messagePattern":"FIFO is empty","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rayon-core/src/job.rs","lineNumber":272,"sourceCode":"\n    pub(super) unsafe fn push(&self, job_ref: JobRef) -> JobRef {\n        // A little indirection ensures that spawns are always prioritized in FIFO order.  The\n        // jobs in a thread's deque may be popped from the back (LIFO) or stolen from the front\n        // (FIFO), but either way they will end up popping from the front of this queue.\n        self.inner.push(job_ref);\n        unsafe { JobRef::new(self) }\n    }\n}\n\nimpl Job for JobFifo {\n    unsafe fn execute(this: *const ()) {\n        unsafe {\n            // We \"execute\" a queue by executing its first job, FIFO.\n            let this = &*(this as *const Self);\n            loop {\n                match this.inner.steal() {\n                    Steal::Success(job_ref) => break job_ref.execute(),\n                    Steal::Empty => panic!(\"FIFO is empty\"),\n                    Steal::Retry => std::hint::spin_loop(),\n                }\n            }\n        }\n    }\n}\n","sourceCodeStart":254,"sourceCodeEnd":279,"githubUrl":"https://github.com/rayon-rs/rayon/blob/ee0a00bdb1ab039e178a215ad5712fb7fa58e58f/rayon-core/src/job.rs#L254-L279","documentation":"Rayon's work-stealing queue panicked because `steal()` repeatedly returned `Steal::Empty` while trying to execute a job as FIFO. This is an internal invariant: a job that reached this path must exist in a queue, so an empty steal indicates a lifecycle bug or misuse of unsafe APIs around job references.","triggerScenarios":"A job reference is executed via `JobRef::execute` (internal rayon-core path) while all worker queues report empty; typically reached only through internal scheduler bugs or incorrect custom unsafe integration with rayon's job API.","commonSituations":"Rare; seen in rayon-core internal scheduler races or when downstream code misuses unsafe job/registry APIs. End users hitting this are usually on a buggy rayon version.","solutions":["Upgrade rayon/rayon-core to the latest patched version","Reduce concurrent use of low-level rayon-core internals (job refs, registries)","Reproduce with a minimal test and file an issue on the rayon repo","As a workaround, switch to a stable thread-pool crate (e.g. std::thread scoped threads)"],"exampleFix":"// before: relying on internal job API\nlet job_ref = unsafe { ... };\njob_ref.execute();\n// after: use public rayon API\nrayon::scope(|s| { s.spawn(|_| work()); });","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust: panics are not catchable at normal call sites; isolate risky work\ncatch_unwind(AssertUnwindSafe(|| rayon::join(work_a, work_b)))","preventionTips":["Pin to patched rayon versions","Avoid unsafe integration with rayon-core internals","Run stress tests to surface scheduler races early"],"tags":["rayon","panic","invariant-violation","concurrency"],"backgroundTag":"internal-invariant-violation","analyzedSha":"ee0a00bdb1ab039e178a215ad5712fb7fa58e58f","analyzedAt":"2026-09-07T23:28:47.588Z","contentChangedAt":"2026-09-07T23:28:47.588Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}