Skip to content

Clean up containers on graceful shutdown - #7244

Open
ghostwriternr wants to merge 1 commit into
cloudflare:mainfrom
ghostwriternr:fix/container-sidecar-shutdown
Open

Clean up containers on graceful shutdown#7244
ghostwriternr wants to merge 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 3 times, most recently from e5fb9de to 7252c38 Compare September 4, 2026 11:11
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 7252c38 to 11500b4 Compare September 4, 2026 11:29
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.

2 participants