facebook/flow · error

PidLog::log: failed to flush

Error message

PidLog::log: failed to flush

What it means

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.

Source

Thrown at rust_port/crates/flow_daemon/src/pid_log.rs:62

            .open(pids_file)?;
        *guard = Some(oc);
        Ok(())
    })
}

pub fn log(reason: Option<&str>, no_fail: bool, pid: u32) {
    if !*enabled().lock().expect("pid_log enabled mutex poisoned") {
        return;
    }
    let pid = sys_utils::pid_of_handle(pid);
    let reason = reason.unwrap_or("unknown");
    let mut guard = log_oc().lock().expect("pid_log log_oc mutex poisoned");
    match guard.as_mut() {
        None if no_fail => {}
        None => panic!("Can't write pid to uninitialized pids log"),
        Some(oc) => {
            writeln!(oc, "{}\t{}", pid, reason).expect("PidLog::log: failed to write");
            oc.flush().expect("PidLog::log: failed to flush");
        }
    }
}

#[derive(Debug)]
pub struct FailedToGetPids;

impl std::fmt::Display for FailedToGetPids {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "FailedToGetPids")
    }
}

impl std::error::Error for FailedToGetPids {}

pub fn get_pids(pids_file: &Path) -> Result<Vec<(u32, String)>, FailedToGetPids> {
    let ic = File::open(pids_file).map_err(|_| FailedToGetPids)?;
    let reader = BufReader::new(ic);

View on GitHub (pinned to f88ac94bcf)

Solutions

  1. Ensure the pids file lives on a local, writable, non-quota-limited filesystem
  2. Free disk space and restart the logging process
  3. Monitor free space where the pids file lives so this is caught before the panic
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: 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.

Common situations: Disk fills exactly between the write and flush; pids.log on a detachable/network volume; containers hitting their writable-layer size limit.

Related errors


AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20). Data as JSON: /api/errors/cc3dc0a3cff80bb0. Report an issue: GitHub.