mirror of
https://github.com/apple/container.git
synced 2026-07-15 14:07:04 +00:00
5917a60339
Fix container hang when starting an invalid executable (#1277). Ensure the `SandboxService.waiters` updated atomically, preventing a slow `wait` from registering continuation after the `SandboxService` has been stopped. Current `ProcessIO.handleProcess` has races between `process.wait()` and `process.start()`. In `process.wait`, `SandboxService.wait` registers and block on a continuation so that later exit of that `LinuxContainer` can resume it. Even if `SandboxService.wait` checks the container state, there can be a race so that `SandboxService.startInitProcess` fails earlier with no continuation to resume, then `SandboxService.wait` registers the continuation, which forever hang the thread.