Skip to content

metadata: bound content store calls during garbage collection - #14016

Open
salman-frs wants to merge 1 commit into
containerd:mainfrom
salman-frs:fix/bound-content-gc-backend-calls
Open

salman-frs wants to merge 1 commit into
containerd:mainfrom
salman-frs:fix/bound-content-gc-backend-calls

Conversation

@salman-frs

Copy link
Copy Markdown

contentStore.garbageCollect holds cs.l while calling the backing content
store. Since DB.cleanupContent strips cancellation, a stalled proxy can hold
the lock forever and block every content operation.

Apply a 30-minute timeout to the backing store calls. The timeout covers the
whole pass rather than each deletion, so the lock hold has one upper bound. The
next GC pass retries any unfinished cleanup.

Fixes: #14010

Copilot AI 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.

Pull request overview

This PR bounds metadata content-store garbage collection’s backend calls with a configurable timeout to prevent daemon-wide stalls when a proxied content store hangs while cs.l is held, aligning with the failure mode described in #14010.

Changes:

  • Adds a new timeout key (io.containerd.timeout.gc.content.cleanup) with a 30-minute default and applies it to the full content GC backend pass.
  • Updates the configuration manpage to document the new timeout.
  • Adds a regression test that simulates a hanging backend Delete and verifies GC exits via deadline.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/man/containerd-config.toml.5.md Documents the new content GC cleanup timeout key and default.
core/metadata/content.go Registers the default timeout and wraps backend GC calls with timeout.WithContext.
core/metadata/content_test.go Adds a synctest-backed unit test covering a hanging backend delete during GC.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@salman-frs
salman-frs marked this pull request as ready for review August 23, 2026 02:49
Copilot AI review requested due to automatic review settings August 24, 2026 20:28
@salman-frs
salman-frs force-pushed the fix/bound-content-gc-backend-calls branch from 29bb5c1 to ff98d94 Compare August 24, 2026 20:28

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 25, 2026 17:50
@salman-frs
salman-frs force-pushed the fix/bound-content-gc-backend-calls branch from ff98d94 to 536c4cb Compare August 25, 2026 17:50

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread core/metadata/content.go Resolved
Copilot AI review requested due to automatic review settings August 25, 2026 18:04
@salman-frs
salman-frs force-pushed the fix/bound-content-gc-backend-calls branch from 536c4cb to b7d234d Compare August 25, 2026 18:04
`contentStore.garbageCollect` holds `cs.l` while calling the backing content store. Since `DB.cleanupContent` strips cancellation, a stalled proxy can hold the lock forever and block every content operation.

Apply a 30-minute timeout to the backing store calls. The timeout covers the whole pass rather than each deletion, so the lock hold has one upper bound. The next GC pass retries any unfinished cleanup.

Fixes: containerd#14010
Signed-off-by: salman-frs <[email protected]>
@salman-frs
salman-frs force-pushed the fix/bound-content-gc-backend-calls branch from b7d234d to db32a7e Compare August 25, 2026 18:08

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 25, 2026 18:09

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@kubernetes-prow

Copy link
Copy Markdown

PR needs rebase.

Details

Instructions 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.

@NahumLitvin

Copy link
Copy Markdown
Contributor

Closing, superseded. Per @fuweid in #14026 the bound moves to the proxy client as an optional default_timeout, covering all 10 methods instead of one component at a time.

@NahumLitvin

Copy link
Copy Markdown
Contributor

Heads up: #14187 puts the timeout in the proxy client as an optional default_timeout, following @fuweid's suggestion in #14026. It covers the snapshot proxy only, so the content side still needs its own key because Writer outlives the call that created it. Leaving it to the maintainers whether that replaces the per-component approach here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

metadata: daemon-wide stalls from unbounded proxy plugin calls (content GC, calls inside bolt transactions)

3 participants