Repository navigation
fix: sandbox containers exhaust process limits after long runs - #103441
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa7f49378b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -47,6 +47,10 @@ export const DEFAULT_SANDBOX_COMMON_IMAGE = "openclaw-sandbox-common:bookworm-sl | |||
| export const SANDBOX_BROWSER_SECURITY_HASH_EPOCH = "2026-05-12-cdp-relay-auth"; | |||
| export const SANDBOX_BROWSER_IMAGE_CONTRACT_EPOCH = "2026-05-12-cdp-relay-auth"; | |||
|
|
|||
| // Bump with shared Docker create-flag changes so existing ordinary and browser | |||
| // sandboxes roll through the hash/recreate path instead of keeping stale flags. | |||
| export const SANDBOX_DOCKER_CREATE_ARGS_EPOCH = "2026-07-10-init"; | |||
There was a problem hiding this comment.
Avoid killing running sandboxes during init rollout
When upgrading with an existing pre-init Docker sandbox whose registry lastUsedAtMs is more than 5 minutes old but which still has an active docker exec or browser workload, this epoch makes it hash-mismatched and the existing ensureSandboxContainer/ensureSandboxBrowser cold branch removes it even though running is true. Long-running commands commonly exceed that window without refreshing the registry timestamp, so the next sandbox ensure can kill valid in-flight work during rollout; defer all running old-epoch containers or check for active work before removing them.
Useful? React with 👍 / 👎.
Co-authored-by: hobo <[email protected]> Co-authored-by: aaajiao <[email protected]>
93f6549 to
0aacb50
Compare
|
Land-ready verification for exact head
Review artifacts are validated with recommendation |
|
Merged via squash.
|
Co-authored-by: hobo <[email protected]> Co-authored-by: aaajiao <[email protected]>
Co-authored-by: hobo <[email protected]> Co-authored-by: aaajiao <[email protected]> (cherry picked from commit f698703)
Closes #68691
Supersedes #74083 and incorporates the rollout design from #76590.
What Problem This Solves
Fixes an issue where long-running sandbox containers could accumulate orphaned zombie processes until their process limit was exhausted, causing otherwise valid commands to fail.
Why This Change Was Made
Docker now starts every ordinary and browser sandbox with its built-in init process. One shared create-arguments epoch participates in both sandbox configuration hashes, so an idle container created under the old arguments is recreated automatically while a recently active container remains running and receives the existing explicit recreate hint. Existing environment, mount, network, capability, and security-policy inputs are unchanged.
Thanks @luckylhb90 for the original fix and @aaajiao for identifying the rollout requirement.
User Impact
New or safely recreated sandbox containers reap orphaned descendants and no longer leak zombie processes toward the configured PID limit. Active containers are not interrupted automatically.
Evidence
HostConfig.Init=true, PID 1 wasdocker-init, and the same orphaned-grandchild scenario left zero zombies.openclaw sandbox recreate --allhint.oxfmtandgit diff --checkpassed.0aacb507926e4416dc0c4d5337668de265b15bdb: run 29072559013.