{"record":{"id":"749ea179d28141b7","repo":"openai/codex","slug":"timed-out-waiting-for-pid-managed-app-server-pid","errorCode":null,"errorMessage":"timed out waiting for pid-managed app server {pid} to stop","messagePattern":"timed out waiting for pid-managed app server (.+?) to stop","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/app-server-daemon/src/backend/pid.rs","lineNumber":282,"sourceCode":"                }\n                if !self.record_is_active(&record).await? {\n                    match self.refresh_after_stale_record(&record).await? {\n                        PidFileState::Missing => return Ok(()),\n                        PidFileState::Starting | PidFileState::Running(_) => break,\n                    }\n                }\n                if tokio::time::Instant::now() >= deadline {\n                    break;\n                }\n                if !forced && started_at.elapsed() >= STOP_GRACE_PERIOD {\n                    self.force_terminate_process(pid)?;\n                    forced = true;\n                }\n                sleep(STOP_POLL_INTERVAL).await;\n            }\n\n            if self.record_is_active(&record).await? {\n                bail!(\"timed out waiting for pid-managed app server {pid} to stop\");\n            }\n        }\n    }\n\n    async fn wait_for_pid_start(&self) -> Result<Option<PidRecord>> {\n        let deadline = tokio::time::Instant::now() + START_TIMEOUT;\n        loop {\n            match self.read_pid_file_state().await? {\n                PidFileState::Missing => return Ok(None),\n                PidFileState::Running(record) => return Ok(Some(record)),\n                PidFileState::Starting if tokio::time::Instant::now() < deadline => {\n                    sleep(STOP_POLL_INTERVAL).await;\n                }\n                PidFileState::Starting => {\n                    bail!(\n                        \"timed out waiting for pid reservation in {} to finish initializing\",\n                        self.pid_file.display()\n                    );","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/app-server-daemon/src/backend/pid.rs#L264-L300","documentation":"stop() polls the pid record until the target app-server process (pid) is no longer active, escalating to force-termination after STOP_GRACE_PERIOD. If the process is still recorded as active when the deadline is reached — it ignored graceful and forced termination, or is stuck un-reaped — stop gives up and reports this timeout instead of blocking forever.","triggerScenarios":"Thrown at codex-rs/app-server-daemon/src/backend/pid.rs:282 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether pid is a zombie or blocked on uninterruptible I/O (ps/proc state)","Increase STOP_GRACE_PERIOD if the server legitimately needs longer to shut down","Clean up the stale pid file manually once the process is confirmed dead"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}