{"record":{"id":"cc3dc0a3cff80bb0","repo":"facebook/flow","slug":"pidlog-log-failed-to-flush","errorCode":null,"errorMessage":"PidLog::log: failed to flush","messagePattern":"PidLog::log: failed to flush","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust_port/crates/flow_daemon/src/pid_log.rs","lineNumber":62,"sourceCode":"            .open(pids_file)?;\n        *guard = Some(oc);\n        Ok(())\n    })\n}\n\npub fn log(reason: Option<&str>, no_fail: bool, pid: u32) {\n    if !*enabled().lock().expect(\"pid_log enabled mutex poisoned\") {\n        return;\n    }\n    let pid = sys_utils::pid_of_handle(pid);\n    let reason = reason.unwrap_or(\"unknown\");\n    let mut guard = log_oc().lock().expect(\"pid_log log_oc mutex poisoned\");\n    match guard.as_mut() {\n        None if no_fail => {}\n        None => panic!(\"Can't write pid to uninitialized pids log\"),\n        Some(oc) => {\n            writeln!(oc, \"{}\\t{}\", pid, reason).expect(\"PidLog::log: failed to write\");\n            oc.flush().expect(\"PidLog::log: failed to flush\");\n        }\n    }\n}\n\n#[derive(Debug)]\npub struct FailedToGetPids;\n\nimpl std::fmt::Display for FailedToGetPids {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        write!(f, \"FailedToGetPids\")\n    }\n}\n\nimpl std::error::Error for FailedToGetPids {}\n\npub fn get_pids(pids_file: &Path) -> Result<Vec<(u32, String)>, FailedToGetPids> {\n    let ic = File::open(pids_file).map_err(|_| FailedToGetPids)?;\n    let reader = BufReader::new(ic);","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_daemon/src/pid_log.rs#L44-L80","documentation":"Panics when flushing the pids log writer fails right after a successful write. The pid log is used to reconcile live process IDs against dead ones (orphan cleanup), so losing buffered PID lines is treated as fatal. Same underlying causes as the write panic: full disk, invalid handle, or vanished filesystem.","triggerScenarios":"pid_log::log reaching oc.flush() when the filesystem returns EIO/ENOSPC; the pids file descriptor invalidated by the OS after the underlying volume disappeared; flush blocked by disk quota enforcement.","commonSituations":"Disk fills exactly between the write and flush; pids.log on a detachable/network volume; containers hitting their writable-layer size limit.","solutions":["Ensure the pids file lives on a local, writable, non-quota-limited filesystem","Free disk space and restart the logging process","Monitor free space where the pids file lives so this is caught before the panic"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a local filesystem for the pids log; avoid network mounts that can vanish","Alert on disk usage where the pids file lives before writes start failing","Restart the process after fixing the volume so init reopens a healthy file handle"],"tags":["rust","logging","io","flush","disk-full"],"backgroundTag":"log-write-failed","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}