Skip to content

Clean up containers on graceful shutdown - #7244

Merged
ghostwriternr merged 1 commit into
cloudflare:mainfrom
ghostwriternr:fix/container-sidecar-shutdown
Sep 17, 2026
Merged

ghostwriternr merged 1 commit into
cloudflare:mainfrom
ghostwriternr:fix/container-sidecar-shutdown

Conversation

@ghostwriternr

Copy link
Copy Markdown
Member

workerd previously left application and sidecar containers behind after SIGTERM because Docker cleanup started too late, after network I/O was already being torn down.

This is a local-dev bug only. Production Durable Object containers are not created through workerd's local Docker engine.

This change ensures cleanup starts after request drain, while Docker I/O is still available. Stop container-enabled actors first so they cannot recreate containers during that cleanup. Cover the SIGTERM path with a process-level test.

The new test is tagged requires-container-engine, so default CI will skip it, matching other Docker tests.

@ghostwriternr
ghostwriternr requested review from a team as code owners September 4, 2026 10:07
@ghostwriternr
ghostwriternr force-pushed the fix/container-sidecar-shutdown branch 4 times, most recently from 7252c38 to 11500b4 Compare September 4, 2026 11:29
@ghostwriternr
ghostwriternr force-pushed the fix/container-sidecar-shutdown branch from f692c30 to be19a8b Compare September 10, 2026 11:03
workerd can leave application and sidecar containers behind after
SIGTERM because Docker cleanup starts after network I/O is torn down.

Start cleanup after requests drain, while Docker I/O remains available.
Stop container-enabled actors first so they cannot recreate containers
during cleanup, and cover the SIGTERM path with a process-level test.

This affects only local development. Production Durable Object
containers do not use workerd's local Docker engine.
@ghostwriternr
ghostwriternr force-pushed the fix/container-sidecar-shutdown branch from be19a8b to 9cfc961 Compare September 16, 2026 23:38
@ghostwriternr
ghostwriternr merged commit cefd15a into cloudflare:main Sep 17, 2026
20 of 21 checks passed
@ghostwriternr
ghostwriternr deleted the fix/container-sidecar-shutdown branch September 17, 2026 09:09
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.

3 participants