Skip to content

feat(ipc): configure entrypoint shutdown timeout - #6558

Open
tmtcam-042 wants to merge 2 commits into
livekit:mainfrom
tmtcam-042:entrypoint-shutdown-timeout
Open

feat(ipc): configure entrypoint shutdown timeout #6558
tmtcam-042 wants to merge 2 commits into
livekit:mainfrom
tmtcam-042:entrypoint-shutdown-timeout

Conversation

@tmtcam-042

Copy link
Copy Markdown

Summary

The job process currently waits for the entrypoint for a hard-coded 15 seconds during shutdown before cancelling it. This makes that grace period configurable through ServerOptions and AgentServer while preserving the existing 15-second default.

Setting entrypoint_shutdown_timeout=0.0 cancels the entrypoint immediately, allowing applications to terminate active calls without waiting for voice playout or other entrypoint work to drain. Shutdown callbacks continue to run after cancellation.

Closes #6512.

Reopened because reviewer was not auto-assigned, don't think CI picks up when a PR promotes from draft to ready!

Changes

  • add entrypoint_shutdown_timeout to ServerOptions, AgentServer, and update_options
  • pass the setting through ProcPool to process and thread job executors
  • use the configured timeout when waiting for the job entrypoint during shutdown
  • cover the default, option forwarding, updates, and immediate-cancellation behavior

Testing

  • uv run pytest tests/test_ipc.py tests/test_worker_config.py --unit -q — 26 passed
  • make check — formatting, Ruff, and mypy passed across all 623 source files

@tmtcam-042
tmtcam-042 requested a review from a team as a code owner July 27, 2026 06:53

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

Copy link
Copy Markdown
Contributor

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 bugs or issues to report.

Open in Devin Review

When None (default), multiprocess mode is disabled and only main process metrics are collected.
Users can also set PROMETHEUS_MULTIPROC_DIR environment variable directly before starting the worker."""
entrypoint_shutdown_timeout: float = 15.0
"""Maximum time to wait for a job entrypoint to exit before cancelling it."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is the timeout only after the job shutdown, the entrypoint can run longer than 15s if the job is running. better to explain this in the docstring.

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.

Allow configuring the job entrypoint shutdown grace period

2 participants