{"record":{"id":"9f095bdcbc83368e","repo":"facebook/flow","slug":"daemon-child-failed-to-set-tcp-nodelay-on-parent","errorCode":null,"errorMessage":"Daemon child: failed to set TCP_NODELAY on parent out-socket: {}","messagePattern":"Daemon child: failed to set TCP_NODELAY on parent out-socket: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust_port/crates/flow_daemon/src/daemon.rs","lineNumber":542,"sourceCode":"    let Some((entry_name, context)) = entry::get_context() else {\n        return;\n    };\n    entry::clear_context();\n    let entry::Context {\n        parent_in_addr,\n        parent_out_addr,\n        token,\n        param_bytes,\n    } = context;\n\n    let mut child_in_sock = TcpStream::connect(parent_out_addr).unwrap_or_else(|e| {\n        panic!(\n            \"Daemon child: failed to connect to parent out-socket (child read end): {}\",\n            e\n        )\n    });\n    child_in_sock.set_nodelay(true).unwrap_or_else(|e| {\n        panic!(\n            \"Daemon child: failed to set TCP_NODELAY on parent out-socket: {}\",\n            e\n        )\n    });\n    child_in_sock.write_all(&token).unwrap_or_else(|e| {\n        panic!(\n            \"Daemon child: failed to write token to parent out-socket: {}\",\n            e\n        )\n    });\n    let mut child_out_sock = TcpStream::connect(parent_in_addr).unwrap_or_else(|e| {\n        panic!(\n            \"Daemon child: failed to connect to parent in-socket (child write end): {}\",\n            e\n        )\n    });\n    child_out_sock.set_nodelay(true).unwrap_or_else(|e| {\n        panic!(","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_daemon/src/daemon.rs#L524-L560","documentation":"Immediately after connecting to the parent's out-socket, the daemon child enables TCP_NODELAY for low-latency writes. set_nodelay failing at this point is an OS-level setsockopt error, which in practice only happens when the socket is already invalid/errored (parent closed it) or the platform refuses the option in the current network context.","triggerScenarios":"The parent closes the accepted socket in the microsecond window between the child's connect and setsockopt; exotic network stacks/sandboxes rejecting TCP_NODELAY on loopback sockets.","commonSituations":"Racing parent exit during daemon spawn; minimal kernel/sandbox network implementations; extremely rare on stock Linux/macOS/Windows.","solutions":["Retry the command (the race window is tiny and rarely repeats)","Run flow stop first to reset any half-spawned daemon state","If persistent in a sandbox, verify TCP socket options are supported and report to the sandbox/network layer owners"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat one-off handshake failures as transient; retry before debugging","In sandboxed runtimes, confirm TCP socket options like TCP_NODELAY are supported","Avoid killing the parent during daemon spawn windows"],"tags":["daemon","socket","tcp-nodelay","spawn","race-condition"],"backgroundTag":"socket-set-option-failed","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}