Skip to content

fix: bound ProcPool process wait#5889

Open
he-yufeng wants to merge 1 commit into
livekit:mainfrom
he-yufeng:fix/proc-pool-warm-timeout
Open

fix: bound ProcPool process wait#5889
he-yufeng wants to merge 1 commit into
livekit:mainfrom
he-yufeng:fix/proc-pool-warm-timeout

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Summary

  • add a bounded wait when ProcPool.launch_job() is waiting for a warmed process
  • retry the existing launch loop when a spawn task exits without putting a process on the queue
  • add a regression test for the empty-queue failure path so the coroutine fails instead of hanging forever

To verify

  • uv run pytest tests/test_ipc.py::test_proc_pool_launch_job_times_out_when_spawn_never_warms_process -q
  • uv run ruff check livekit-agents\livekit\agents\ipc\proc_pool.py tests\test_ipc.py
  • uv run ruff format --check livekit-agents\livekit\agents\ipc\proc_pool.py tests\test_ipc.py
  • uv run python -m py_compile livekit-agents\livekit\agents\ipc\proc_pool.py tests\test_ipc.py
  • git diff --check

tests/test_ipc.py::test_slow_initialization timed out after 120s on my Windows machine without producing test output; I did not treat that as part of this patch because the new regression test isolates the empty warmed-process queue path without spawning worker processes.

Closes #5868

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: jobs stall indefinitely when process initialization times out (ProcPool._warmed_proc_queue.get() has no timeout)

1 participant