wide-flower-24692
02/17/2026, 5:41 AMtall-airline-16756
02/17/2026, 5:41 AMtall-airline-16756
02/17/2026, 5:41 AMproc.aclose() a timeout/cancellation occurred, then the code attempted self._proc.kill().
• Python raised ValueError("process object is closed") because the multiprocessing Process had already been closed (exited or otherwise cleaned up) before the kill was attempted.
What this means for you
• This is a process lifecycle race: the agent attempted to force-kill a process that had already been closed, which produces noisy error logs but does not necessarily indicate the job failed in a way that affects other jobs.
• You may still want to eliminate the exception to reduce log noise and ensure clean shutdown behavior.
Recommended next steps (actionable)
1. Add a safe-check before calling kill
◦ Update the kill/send-kill logic to skip calling kill() when the process is already closed or not alive. Example:
if self._proc is None or not self._proc.is_alive():
return
self._proc.kill()
• This prevents ValueError when the process has already terminated.
1. Catch and ignore ValueError at shutdown
◦ Wrap the termination sequence in a try/except so a closed-process error is handled gracefully:
try:
await self._send_kill_signal()
except ValueError:
# process already closed, nothing to do
pass
1. Make aclose() tolerant to already-closed processes
◦ When implementing aclose(), check process state and avoid sending signals if closed; also catch asyncio.TimeoutError and ValueError and proceed to cleanup.
1. Add debug logging around termination
◦ Log process state immediately before attempting termination so you can confirm whether the process was already dead:
logger.debug(f"Terminating job {job_id}; process alive={self._proc.is_alive()}")
1. Check shutdown sequencing and external signals
◦ Verify no external lifecycle (container/platform) signal causes the process to exit prior to agent termination logic.
◦ Confirm drain_timeout and graceful-shutdown settings are appropriate for your jobs so forced-kill logic is rarely needed.
If you want, I can:
• Point to the specific files and lines to change if you share the agent version or repo layout.
• Draft a small patch for SupervisedProc.aclose() and the _handle_termination handler that implements the checks and exception handling above.
• Help interpret further logs if this error recurs after changes (please include the agent version and the surrounding logs).
Which would you like to do next?
Sources: Job lifecycle | LiveKit Documentation | Server options | LiveKit Documentation | Self-hosted deployments | LiveKit Documentation