Repository navigation
Explain why a oneshot instance died in the router's 502 body - #155
Closed
pistachiobaby wants to merge 1 commit into
Closed
pistachiobaby wants to merge 1 commit into
pistachiobaby wants to merge 1 commit into
Conversation
Before releasing a failed oneshot pod, the controller reads its status and returns OOMKilled, the exit code, or who terminated it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a oneshot pod dies mid-request, the router's 502 now has a JSON body saying why. Standard functions keep the empty 502. On local OrbStack, 4 real OOM kills through the router came back
OOMKilledwith the 256Mi limit within 1.1 s, and a mid-request eviction came backEvictionByEvictionAPI. The full suite (1,267 tests) passes locally and on CI's kind cluster.The problem
In the 30 days to 15 Oct 2026, 38 operation-runner
runCommandrequests ended in an empty 502 (failed to forward request,EOF). 19 matched kernel OOM kills; the other 19 have no known cause. The pod's container status records why (OOMKilled, exit 137), but the router releases the pod right after the error, and deleting it discards that status.Now the router calls
ReleaseInstancewithreport_termination. The controller reads the pod every 250 ms for up to--instance-termination-wait(5 s), returns the reason, then deletes it. It waits because the kubelet notices a dead container on its next relist (every 1 s). The controller reads because the router has no pod RBAC (Gadget's production role grants pods*). The body:{"error":"instance operation-runner-…-x2k8p stopped before it responded: container \"runner\" ran out of memory and was killed at its 6Gi limit (exit code 137)","reason":"OOMKilled","instance":"operation-runner-…-x2k8p","container":"runner","exitCode":137,"memoryLimitBytes":6442450944}reason:OOMKilled,PodTerminated,ContainerExited, orUnknown. A liveness-probe kill shows asContainerExited, since Kubernetes records probes only as Events.container,exitCode: onOOMKilledandContainerExited.memoryLimitBytes: onOOMKilled.terminatedBy: onPodTerminatedwhen known.HeartbeatTimeoutif skipper deleted the pod, else Kubernetes'DisruptionTargetreason (EvictionByEvictionAPI,TerminationByKubelet).Why annotate heartbeat-timeout deletes
A heartbeat timeout deletes every pod of a oneshot function, running commands included.
ReleaseInstancecan land on any controller, so the deleting one first writesskipper/terminated-by: HeartbeatTimeouton the pod: one extra patch per orphaned pod.Not verified
Unknown.Next: the Gadget api reads
body.reasoninOperationRunnerClient, a follow-up to gadget-inc/gadget#20960.🤖 Generated with Claude Code