Skip to content

runsc: return the lock error in Container.Update - #15632

Merged
copybara-service[bot] merged 1 commit into
google:masterfrom
LemonCondor:runsc-update-check-lock-error
Oct 12, 2026
Merged

copybara-service[bot] merged 1 commit into
google:masterfrom
LemonCondor:runsc-update-check-lock-error

Conversation

@LemonCondor

Copy link
Copy Markdown
Contributor

Container.Update ignores the error returned by c.Saver.lock(BlockAcquire). When the state file lock cannot be acquired, the deferred c.Saver.unlock() then panics with unlock called without lock held, so runsc update crashes instead of returning the error.

This checks the error the same way the other c.Saver.lock(BlockAcquire) call sites in container.go already do.

Testing: reproduced with a throwaway unit test (a Container whose Saver.RootDir does not exist, non-root container so the cgroup path is skipped): before this change Update panics with unlock called without lock held; after it, Update returns the lock error. go vet ./runsc/container/ is clean. The regression test is not included because the tests in this package are Bazel integration tests that need root and a runsc binary, which I could not run here.

This change was prepared with AI assistance (Claude Code) and reviewed by me before submission.

@google-cla

google-cla Bot commented Oct 10, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Container.Update ignored the error from c.Saver.lock(BlockAcquire). If the
state file lock cannot be acquired, the deferred c.Saver.unlock() panics
with "unlock called without lock held", so "runsc update" crashes instead
of reporting the error. Check the error like the other lock call sites in
this file.

Assisted-by: Claude Code
copybara-service Bot pushed a commit that referenced this pull request Oct 12, 2026
`Container.Update` ignores the error returned by `c.Saver.lock(BlockAcquire)`. When the state file lock cannot be acquired, the deferred `c.Saver.unlock()` then panics with `unlock called without lock held`, so `runsc update` crashes instead of returning the error.

This checks the error the same way the other `c.Saver.lock(BlockAcquire)` call sites in `container.go` already do.

Testing: reproduced with a throwaway unit test (a `Container` whose `Saver.RootDir` does not exist, non-root container so the cgroup path is skipped): before this change `Update` panics with `unlock called without lock held`; after it, `Update` returns the lock error. `go vet ./runsc/container/` is clean. The regression test is not included because the tests in this package are Bazel integration tests that need root and a runsc binary, which I could not run here.

This change was prepared with AI assistance (Claude Code) and reviewed by me before submission.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#15632 from LemonCondor:runsc-update-check-lock-error 4a8a3ac
PiperOrigin-RevId: 997202195
@copybara-service
copybara-service Bot merged commit 35cc043 into google:master Oct 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants