{"record":{"id":"2a01de325ddf1533","repo":"facebook/flow","slug":"daemon-child-failed-to-set-tcp-nodelay-on-parent-2a01de","errorCode":null,"errorMessage":"Daemon child: failed to set TCP_NODELAY on parent in-socket: {}","messagePattern":"Daemon child: failed to set TCP_NODELAY on parent in-socket: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust_port/crates/flow_daemon/src/daemon.rs","lineNumber":560,"sourceCode":"        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!(\n            \"Daemon child: failed to set TCP_NODELAY on parent in-socket: {}\",\n            e\n        )\n    });\n    child_out_sock.write_all(&token).unwrap_or_else(|e| {\n        panic!(\n            \"Daemon child: failed to write token to parent in-socket: {}\",\n            e\n        )\n    });\n\n    exec(&entry_name, child_in_sock, child_out_sock, param_bytes);\n}\n\npub fn close<I, O>(h: &mut Handle<I, O>) -> std::io::Result<()> {\n    h.channels.0.stream.shutdown(std::net::Shutdown::Read)?;\n    h.channels.1.stream.shutdown(std::net::Shutdown::Write)?;\n    Ok(())","sourceCodeStart":542,"sourceCodeEnd":578,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_daemon/src/daemon.rs#L542-L578","documentation":"Mirror of the out-socket step: after connecting to the parent's in-socket, the daemon child enables TCP_NODELAY on it before writing the token. Failure is an OS-level setsockopt error, realistically only seen when the just-connected socket is already invalid (parent closed it) or the platform rejects the option.","triggerScenarios":"Parent closes the in-socket between the child's connect and setsockopt; sandboxed network stacks that do not implement TCP_NODELAY on loopback sockets.","commonSituations":"Handshake races during daemon spawn on loaded machines; minimal container network implementations; otherwise near-never on standard OSes.","solutions":["Retry the command; the race window is tiny","flow stop before retrying to clear half-spawned state","If reproducible in a sandbox, confirm TCP socket option support and escalate to the platform owners"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Retry once; the connect-to-setsockopt race window is tiny","Validate sandbox network stacks support standard TCP socket options","Keep daemon spawn windows free of process-tree kills"],"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-23T11:17:13.642Z"}