{"record":{"id":"54f094633c3610a7","repo":"gastownhall/beads","slug":"timeout-s-waiting-for-process-exit","errorCode":null,"errorMessage":"timeout (%s) waiting for process exit","messagePattern":"timeout \\((.+?)\\) waiting for process exit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dbproxy/proxy/endpoint.go","lineNumber":936,"sourceCode":"\t\t// A different birth token proves the recorded process exited, even\n\t\t// when the numeric PID has since been recycled.\n\t\treturn nil, true, nil\n\t}\n\treturn nil, false, fmt.Errorf(\"open verified process handle: %w\", err)\n}\n\nfunc waitForRecordedProcessExit(pf *pidfile.PidFile, timeout time.Duration) error {\n\tdeadline := time.Now().Add(timeout)\n\tfor {\n\t\tmatched, err := procid.Verify(pf.Pid, procid.Token(pf.Birth))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !matched {\n\t\t\treturn nil\n\t\t}\n\t\tif time.Now().After(deadline) {\n\t\t\treturn fmt.Errorf(\"timeout (%s) waiting for process exit\", timeout)\n\t\t}\n\t\ttime.Sleep(shutdownConfirmPoll)\n\t}\n}\n\nfunc killSpawnedChild(child *spawnedProxyChild) error {\n\tselect {\n\tcase <-child.done:\n\t\treturn nil\n\tdefault:\n\t}\n\tif child.handle == nil {\n\t\t// No verified handle could be opened at spawn time. The child is our\n\t\t// own un-reaped process, so its PID cannot have been recycled and a\n\t\t// direct kill is safe; the alternative is leaking a live proxy child.\n\t\tif err := child.cmd.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) {\n\t\t\treturn fmt.Errorf(\"kill spawned proxy child pid %d: %w\", child.cmd.Process.Pid, err)\n\t\t}","sourceCodeStart":918,"sourceCodeEnd":954,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dbproxy/proxy/endpoint.go#L918-L954","documentation":"Error \"timeout (%s) waiting for process exit\" thrown in gastownhall/beads.","triggerScenarios":"Thrown at internal/storage/dbproxy/proxy/endpoint.go:936 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}