Repository navigation
fix: synchronize gc plugin stops before metadata plugin closes - #13353
austinvazquez wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR is a follow-up to #13348 to ensure containerd shutdown does not close the metadata DB while the GC scheduler may still be running a collection. It does so by making the GC scheduler plugin implement io.Closer and blocking shutdown until the scheduler run loop exits.
Changes:
- Add a
donesignal to the GC scheduler and implementClose()to wait for the run loop to stop. - Update the scheduler run loop to close
doneon exit. - Add a unit test asserting
Close()blocks until an in-progress GC completes and the run loop exits.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| plugins/gc/scheduler.go | Adds done signaling and a blocking Close() intended to serialize shutdown vs. in-flight GC. |
| plugins/gc/scheduler_test.go | Adds a new test covering Close() waiting behavior during an in-flight collection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
14c06b2 to
37b28a5
Compare
37b28a5 to
a3ee975
Compare
a3ee975 to
712b389
Compare
712b389 to
6c9c018
Compare
6c9c018 to
6f7e338
Compare
6f7e338 to
449d5ce
Compare
|
I opened #13588 to resolve the flaky test on Windows that appeared in CI on this PR. Pre-existing issue; unrelated to the changes here. Succeeded on retry. |
Synchronize the gc scheduler to complete all collections before metadata plugin is closed during server shutdown. The scheduler's event senders (mutationCallback and the wait() trigger) deliver to an unbuffered eventC via fire-and-forget goroutines. Once the run loop exists on Close(), nothing will read eventC, so gate sending events on scheduler done to prevent leaking a goroutine per metadata mutation. Pending wait() callers using a context distinct from the run loop's could likewise hang until their own context expired. Risk is low since server is shutting down, but graceful teardown is desirable. In-flight and late callers are released with errSchedulerClosed instead of blocking. Signed-off-by: Austin Vazquez <[email protected]>
Signed-off-by: Austin Vazquez <[email protected]>
449d5ce to
64ae073
Compare
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Issue
Follow-up to #13348
This change synchronizes the gc scheduler completes all collections before metadata plugin is closed during server shutdown.
Additional context
From https://github.com/containerd/containerd/actions/runs/27363955475/job/80859027083, commit 449d5ce adds synchronization to CRI integration test to close all initialized plugins before the containerd state directory is cleaned up. Additional protection like mount manager no error on directory not found to be considered separately.