You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A --cost-limit (or TTL) termination sends the --command process no signal and gives it no grace period #1554
area:lifecycleTTL / idle / on-complete / hibernation / reaperarea:sporedon-node agent: lifecycle, telemetry, readinessspend-safetyBugs where a cost control does not do what it says — real-money risktype:bug
Split out of #1497, whose first half (Spot instances charged at the on-demand rate) is fixed by the PR linked there. This is its second half, which that PR does not touch.
What happens. When the cost limit fires, pkg/agentcheckAndAct calls a.terminate(ctx, "cost limit reached ...", taskproto.ExitCostLimitExceeded). terminate (pkg/agent/agent.go) runs runPreStop (the task flush hook, then the user's --pre-stop if any), Cleanup, warns logged-in users, sleeps shutdownWarnDelay (5 s) and calls provider.Terminate. Nothing signals the --command process: there is no SIGTERM and no grace period, so the job is killed mid-step by the instance going away. The only syscall.SIGTERM handling in pkg/agent is queue_runner.go's own signal.Notify. The reporter's instance terminated 5 s after the job's last log sync, with no final log or result upload.
A spawn task run instance gets a terminal record and a command.log upload from the flush hook (#632, #1186). A plain spawn launch --command gets neither, unless the user has set --pre-stop.
When a lifecycle limit fires, send SIGTERM to the --command process group, wait a configurable grace period (e.g. 2 min, bounded by the Spot notice on a Spot interruption), then terminate.
Tag the instance with the reason (for example spawn:terminated-by=cost-limit), so spawn list and CloudTrail show why. It needs a tag-reserve slot (pkg/aws post_launch_tags.go).
When the limit is below TTL x rate, say in the launch output that spawn extend --raise-cost-limit exists.
area:lifecycleTTL / idle / on-complete / hibernation / reaperarea:sporedon-node agent: lifecycle, telemetry, readinessspend-safetyBugs where a cost control does not do what it says — real-money risktype:bug
Activity