{"record":{"id":"e6899112272da4da","repo":"facebook/flow","slug":"daemon-child-failed-to-connect-to-parent-in-socke","errorCode":null,"errorMessage":"Daemon child: failed to connect to parent in-socket (child write end): {}","messagePattern":"Daemon child: failed to connect to parent in-socket \\(child write end\\): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust_port/crates/flow_daemon/src/daemon.rs","lineNumber":554,"sourceCode":"        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!(\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);","sourceCodeStart":536,"sourceCodeEnd":572,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_daemon/src/daemon.rs#L536-L572","documentation":"Second half of the daemon child's reconnect: TcpStream::connect to parent_in_addr (the child's write end) must succeed after the out-socket connected. This panic fires when that connect fails: the parent exited/closed the second listener between the two connects, loopback connects are refused/rate-limited, or the sandbox blocks the additional connection.","triggerScenarios":"Parent dies in the window between the child's first and second connect; connection-rate limiting or ephemeral port exhaustion on loopback; sandbox policies permitting one connection but refusing rapid follow-ups.","commonSituations":"Parent crash during spawn under memory pressure; container/sandbox network limits; CI runners with aggressive conntrack recycling; supervisors tearing down the process tree mid-handshake.","solutions":["Retry the command after flow stop to reset daemon state","Verify the parent process stays alive through spawn (check its logs/crash reason)","Loosen loopback connection-rate limits in sandboxes if applicable","Report if it reproduces deterministically with a given sandbox or kernel"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Retry after flow stop to clear half-spawned state","Check loopback connection-rate/conntrack limits in containers if it recurs","Ensure the parent stays alive across both child connects (check its crash logs)"],"tags":["daemon","socket","connect","loopback","spawn"],"backgroundTag":"connection-refused","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T11:17:13.642Z"}