{"record":{"id":"c778511dbe0b9783","repo":"tinyhumansai/openhuman","slug":"flushing-pool-job-request","errorCode":null,"errorMessage":"flushing pool job request","messagePattern":"flushing pool job request","errorType":"exception","errorClass":"SubmitError","httpStatus":null,"severity":"error","filePath":"src/openhuman/runtime/pool/worker.rs","lineNumber":235,"sourceCode":"    /// only fires if the worker itself has wedged. On `Err` the caller must\n    /// discard this worker — its stdio framing can no longer be trusted.\n    pub async fn submit(\n        &mut self,\n        req: &PoolJobRequest,\n        hard_timeout: Option<Duration>,\n    ) -> std::result::Result<PoolJobResponse, SubmitError> {\n        let mut line = serde_json::to_string(req)\n            .map_err(|e| SubmitError::pre(anyhow::Error::new(e).context(\"serialising pool job\")))?;\n        line.push('\\n');\n        // A write failure means the bytes never reached the worker (e.g. a\n        // reused idle worker died) → the job did not run → safe to retry.\n        self.stdin.write_all(line.as_bytes()).await.map_err(|e| {\n            SubmitError::pre(anyhow::Error::new(e).context(\"writing pool job request\"))\n        })?;\n        // Past this point the request bytes are in the pipe: the job may execute,\n        // so any later failure is terminal (never re-run the same job).\n        self.stdin.flush().await.map_err(|e| {\n            SubmitError::post(anyhow::Error::new(e).context(\"flushing pool job request\"))\n        })?;\n\n        // Fixed deadline: `continue`ing over unparseable / mismatched-id lines\n        // must NOT reset the wedged-worker timeout, so it bounds the total wait.\n        let deadline = hard_timeout.map(|t| tokio::time::Instant::now() + t);\n        loop {\n            let next = match deadline {\n                Some(dl) => match tokio::time::timeout_at(dl, self.responses.next_line()).await {\n                    Ok(inner) => inner,\n                    Err(_) => {\n                        return Err(SubmitError::post(anyhow::anyhow!(\n                            \"pool worker job timed out (hard deadline; worker wedged)\"\n                        )))\n                    }\n                },\n                None => self.responses.next_line().await,\n            };\n            let line = match next {","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/runtime/pool/worker.rs#L217-L253","documentation":"Flushing the worker's stdin after writing the job line failed — the newline-terminated request was buffered but never delivered. Like the write error it is a pre-submit failure: the worker did not receive the job, so the caller may discard this worker and resubmit elsewhere without risking duplicate execution.","triggerScenarios":"Thrown at src/openhuman/runtime/pool/worker.rs:235 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat the worker as unusable and resubmit the job to a new worker","Investigate the worker process state (broken pipe means it exited; check crash logs)","Reduce pool worker lifetime or add liveness pings to detect half-dead workers early"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}