Repository navigation
Description
Problem
When a sandbox is terminated by OOM, a subsequent business operation can fail with a generic route timeout instead of an actionable termination reason. Users cannot distinguish a sandbox memory limit failure from a routing or infrastructure outage through akernel-sdk alone.
Observed in a private deployment: sandboxd recorded OOMKilled:true, while later process-list or command-start requests returned the following sanitized response:
HTTP 500
{"code":500,"message":"wait for instance <sandbox-id> route: context deadline exceeded","data":null}
OOM was confirmed from service-side evidence, not inferred from the HTTP error or exit code. No independent reproduction has been completed on an unmodified upstream release, and the deployment is not claimed to match the public source revision below.
Public source observations
- AKernel SandboxInfo at 19cb171 exposes state and resource configuration without a sandbox termination reason or OOM field.
- sandboxd Wait at 7f16edd already includes an OOM explanation in
WaitResponse.Messagewhen the persisted OOM flag is set.
This should be tracked across the service API and SDK: the SDK cannot reconstruct a termination reason that the service has discarded or failed to associate with a request.
Expected behavior and acceptance criteria
- Preserve a sandbox terminal record with a machine-readable reason, exit time, and exit code when available. Document its retention period after runtime and route cleanup.
- For a confirmed sandbox OOM, subsequent operations return a specific termination error promptly instead of waiting for a route timeout. A code such as
SANDBOX_OOM_KILLEDis illustrative, not a required API name. - Expose the terminal reason through a documented API/SDK query and an identifiable SDK error, without requiring users to access cluster credentials or operator logs.
- Distinguish OOM, normal completion, explicit deletion, and node loss. Unknown reasons remain unknown; neither exit code 128/137 nor a route timeout alone proves OOM.
- Add integration coverage for OOM followed by command/process queries and terminal-state retrieval after cleanup, plus tests for the other termination paths. OOM of an individual child process must not automatically classify a still-running sandbox as terminated.
Proposed upstream reproduction (not yet executed)
- Create a disposable sandbox with a small, enforced memory limit.
- Run a workload that triggers termination of the sandbox and verify a reliable runtime/cgroup OOM signal.
- Call process-list/command-start and the SDK state query using the same sandbox ID.
- Check whether the client receives and can query the OOM reason after runtime/route cleanup.
The report intentionally omits private cluster identifiers, endpoints, credentials, and raw business logs.
Activity
rcyw commentedon Oct 12, 2026
@WenYuLuo