facebook/flow · critical

Daemon child: failed to connect to parent out-socket (child

Error message

Daemon child: failed to connect to parent out-socket (child read end): {}

What it means

After fork/spawn, the daemon child reconnects to the parent's sockets used as its stdin/stdout channels. This panic fires when TcpStream::connect to parent_out_addr (the child's read end) fails: the parent already exited or closed its listener, the loopback connect was refused/reset, the backlog was exhausted, or loopback networking is unavailable in the environment.

Source

Thrown at rust_port/crates/flow_daemon/src/daemon.rs:536

        ),
        child,
    })
}

pub fn check_entry_point() {
    let Some((entry_name, context)) = entry::get_context() else {
        return;
    };
    entry::clear_context();
    let entry::Context {
        parent_in_addr,
        parent_out_addr,
        token,
        param_bytes,
    } = context;

    let mut child_in_sock = TcpStream::connect(parent_out_addr).unwrap_or_else(|e| {
        panic!(
            "Daemon child: failed to connect to parent out-socket (child read end): {}",
            e
        )
    });
    child_in_sock.set_nodelay(true).unwrap_or_else(|e| {
        panic!(
            "Daemon child: failed to set TCP_NODELAY on parent out-socket: {}",
            e
        )
    });
    child_in_sock.write_all(&token).unwrap_or_else(|e| {
        panic!(
            "Daemon child: failed to write token to parent out-socket: {}",
            e
        )
    });
    let mut child_out_sock = TcpStream::connect(parent_in_addr).unwrap_or_else(|e| {
        panic!(

View on GitHub (pinned to f88ac94bcf)

Solutions

  1. Retry the flow command; a clean respawn usually completes the handshake
  2. Run flow stop to clear half-spawned daemons first
  3. In containers, confirm loopback TCP is permitted and conntrack/limits are sane
  4. Check parent-side logs for an early crash that closed the listener

Example fix

# before
flow check   # daemon child panics: failed to connect to parent out-socket

# after
flow stop
flow check   # if it recurs, inspect parent crash logs / sandbox network policy
Defensive patterns

Strategy: retry

Prevention

When it happens

Trigger: Parent flow process dies between spawning the child and the child's connect; sandbox/container denies loopback TCP connects; ephemeral port or connection-rate exhaustion; firewall/endpoint security interfering with 127.0.0.1 sockets.

Common situations: Flow server parent crashing on startup under memory pressure; gVisor/Firecracker-style sandboxes restricting loopback; aggressive conntrack limits; tooling that kills process trees while a daemon is spawning.

Related errors


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