Stream: git-wasmtime

Topic: wasmtime / PR #14392 Serve: Add `--idle-process-timeout` ...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2026 at 20:36):

simolus3 opened PR #14392 from simolus3:idle-process-timeout to bytecodealliance:main:

wasmtime serve can inherit sockets from systemd, which is convenient to start it lazily when needed. Since socket activation is attractive for services that don't receive continuous traffic, it would also be nice to stop after a while of inactivity. systemd then continues to monitor the socket and will restart the service on the next request.

This adds the --idle-process-timeout option: After the first connection has been opened [^1], a task monitors the amount of active connections. Once no connections are detected for the idle timeout, we start a graceful shutdown.

This operates on a connection level, meaning that idle keep-alive connections keep the process alive. I think this is reasonable for a service, as it's still serving something. Most reverse-proxies have options to reduce idle connection times.

There's an inherent race as it's possible for the idle shutdown to fire just after the connection has been accepted. This means that the connection still gets served while no further connections would be accepted until the process restarts. Not ideal, but this should also be rare in practice. No unaccepted connections are lost because systemd immediately restarts the service, this just increases latency.

Discussed in https://github.com/bytecodealliance/wasmtime/issues/14289#issuecomment-5586772709.


[^1]: Waiting for the first connection avoids a race in tests where the child could technically exit before the test host.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2026 at 20:36):

simolus3 requested wasmtime-core-reviewers for a review on PR #14392.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2026 at 20:36):

simolus3 requested dicej for a review on PR #14392.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2026 at 21:32):

:thumbs_up: alexcrichton submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2026 at 21:32):

alexcrichton has enabled auto merge for PR #14392.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2026 at 21:33):

alexcrichton added PR #14392 Serve: Add --idle-process-timeout option to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2026 at 22:00):

:check: alexcrichton merged PR #14392.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2026 at 22:00):

alexcrichton removed PR #14392 Serve: Add --idle-process-timeout option from the merge queue.


Last updated: Oct 11 2026 at 04:10 UTC