Skip to content

Fix races in shim version queries and RPC shutdown - #14358

Merged
copybara-service[bot] merged 1 commit into
gvisor:masterfrom
tamird:checklocks-control-fixes
Sep 16, 2026
Merged

copybara-service[bot] merged 1 commit into
gvisor:masterfrom
tamird:checklocks-control-fixes

Conversation

@tamird

@tamird tamird commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Version needs the configured runsc binary while sandbox creation is in progress. Publish a copy of the command through an atomic pointer so the version probe neither races with updates nor waits for the service mutex held during creation. Use the default binary when the command is unset or empty, and remove the unused shim root field.

Snapshot registered RPC stoppers under their mutex, then invoke callbacks after unlocking so callbacks can reenter the server.

Repair port-forward fixture synchronization, buffer ownership, short-read handling, and cleanup. Replace the close-order test's sleep with explicit synchronization.

Assisted-by: Codex

@tamird

tamird commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

r? @fvoznika for shim snapshots, unlocked URPC stopper callbacks and port-forward fixture ownership.

The cumulative diff is 8 files (+292/−197), centered on pkg/shim/v1/runsc/; pkg/urpc/; runsc/boot/portforward/.

Assisted-by: Codex

@tamird tamird changed the title checklocks: fix control state and test ownership Fix races in shim version queries and RPC shutdown Sep 3, 2026
@tamird
tamird force-pushed the checklocks-control-fixes branch from 1d68980 to df401f0 Compare September 3, 2026 21:31
@parth-opensrc parth-opensrc added the ready to pull Causes the PR to be imported into Google. Will be removed soon. label Sep 4, 2026
@tamird

tamird commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@parth-opensrc I see there are some failures on the import PR but I can't see what they are. Is there any action required here?

copybara-service Bot pushed a commit that referenced this pull request Sep 9, 2026
Snapshot the configured runtime command and registered RPC stoppers under their mutexes, then execute the command and stopper callbacks after unlocking.

Repair port-forward fixture synchronization, buffer ownership, short-read handling, and cleanup. Replace the existing close-order test’s sleep with explicit synchronization.

Assisted-by: Codex
FUTURE_COPYBARA_INTEGRATE_REVIEW=#14358 from tamird:checklocks-control-fixes df401f0
PiperOrigin-RevId: 976100909
copybara-service Bot pushed a commit that referenced this pull request Sep 9, 2026
Snapshot the configured runtime command and registered RPC stoppers under their mutexes, then execute the command and stopper callbacks after unlocking.

Repair port-forward fixture synchronization, buffer ownership, short-read handling, and cleanup. Replace the existing close-order test’s sleep with explicit synchronization.

Assisted-by: Codex
FUTURE_COPYBARA_INTEGRATE_REVIEW=#14358 from tamird:checklocks-control-fixes df401f0
PiperOrigin-RevId: 976100909
copybara-service Bot pushed a commit that referenced this pull request Sep 9, 2026
Snapshot the configured runtime command and registered RPC stoppers under their mutexes, then execute the command and stopper callbacks after unlocking.

Repair port-forward fixture synchronization, buffer ownership, short-read handling, and cleanup. Replace the existing close-order test’s sleep with explicit synchronization.

Assisted-by: Codex
FUTURE_COPYBARA_INTEGRATE_REVIEW=#14358 from tamird:checklocks-control-fixes df401f0
PiperOrigin-RevId: 976100909
@milantracy

Copy link
Copy Markdown
Member

@tamird please squash your commits into one for the PR. Otherwise, we can't import and merge this change

@milantracy milantracy removed the ready to pull Causes the PR to be imported into Google. Will be removed soon. label Sep 9, 2026
@milantracy
milantracy self-requested a review September 9, 2026 18:21
@tamird
tamird force-pushed the checklocks-control-fixes branch from df401f0 to 9db8cde Compare September 9, 2026 18:58
@tamird

tamird commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@milantracy done.

Comment thread pkg/shim/v1/runsc/service.go Resolved
@tamird
tamird force-pushed the checklocks-control-fixes branch 2 times, most recently from 41bb56f to 89b2992 Compare September 9, 2026 22:04
Publish a copy of the configured runsc command atomically when the
sandbox is created. Version reads it without racing with updates or
waiting for container creation. Preserve the default command before
creation and when the configured command is empty. Remove the unused
shim root field.

Snapshot registered RPC stoppers under their mutex and run callbacks
after unlocking, so callbacks can reenter the server.

Synchronize port-forward test waiters and return owned buffers. Handle
short reads and fixture cleanup, and coordinate the close-order test
without sleeps.

Assisted-by: Codex
@tamird
tamird force-pushed the checklocks-control-fixes branch from 89b2992 to 6ca77eb Compare September 9, 2026 22:08
@tamird

tamird commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

@milantracy looks like this failed to import, does it need the ready to pull label?

@parth-opensrc parth-opensrc added the ready to pull Causes the PR to be imported into Google. Will be removed soon. label Sep 16, 2026
copybara-service Bot pushed a commit that referenced this pull request Sep 16, 2026
Snapshot the configured runtime command and registered RPC stoppers under their mutexes, then execute the command and stopper callbacks after unlocking.

Repair port-forward fixture synchronization, buffer ownership, short-read handling, and cleanup. Replace the existing close-order test’s sleep with explicit synchronization.

Assisted-by: Codex
FUTURE_COPYBARA_INTEGRATE_REVIEW=#14358 from tamird:checklocks-control-fixes 6ca77eb
PiperOrigin-RevId: 976100909
copybara-service Bot pushed a commit that referenced this pull request Sep 16, 2026
Snapshot the configured runtime command and registered RPC stoppers under their mutexes, then execute the command and stopper callbacks after unlocking.

Repair port-forward fixture synchronization, buffer ownership, short-read handling, and cleanup. Replace the existing close-order test’s sleep with explicit synchronization.

Assisted-by: Codex
FUTURE_COPYBARA_INTEGRATE_REVIEW=#14358 from tamird:checklocks-control-fixes 6ca77eb
PiperOrigin-RevId: 976100909
@copybara-service
copybara-service Bot merged commit 88969d2 into gvisor:master Sep 16, 2026
8 checks passed
@tamird
tamird deleted the checklocks-control-fixes branch September 16, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to pull Causes the PR to be imported into Google. Will be removed soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

⌂ 换网址