HydraIssues

A dequeued exec that never returns wedges a node's exec queue for ever, and the per-request timeout does not fire
open bug Project: Reporter: 14 Oct 2026 22:10

Description

Hit on node-50ab5309 (pi-node-004) on 2026-10-14 while deploying hydraexperiencelibrary v0.20.0. It cost about 40 minutes and blocked a deploy six days before the zone opens.

What happens

hydranode dequeues one exec at a time. If that exec never reports a result, the node stops dequeuing anything, for ever. Everything else on the node keeps working: heartbeats continue every 30s, scales_reported_at stays fresh, every service on the node answers, and the node reads online in the API. Only the exec worker is dead, and nothing says so.

From the agent's own log, every exec finishing in under 140ms, then one that never finishes:

22:25:15 exec request exec-1792009513456: incus config device show hydraexperiencelibrary
22:25:15 exec exec-1792009513456 finished: exit_code=0 duration=32ms
22:27:33 exec request exec-1792009652186: for s in hydraorganization hydrastreamingmonitor hydrabooks; do echo "== $s"; in...
(no finished line, ever)

The queue confirms it:

GET /api/v1/nodes/node-50ab5309/exec/queue
{"in_flight":1,"queued":12, ...}

in_flight: 1 was that command. The other 12 were never dequeued, including hydraskin update hydraexperiencelibrary --tag v0.20.0 --apply.

Two separate faults

1. The timeout does not fire. The request carried "timeout":90. It was stuck for over 40 minutes. No process from it was left running on the node (ps -eo pid,etimes,stat,args | grep "incus exec" was empty), so the command itself had ended and the agent was blocked after it. That is the shape of a child that exited while a grandchild still holds the output pipe: killing the child does not unblock a read of that pipe. An exec timeout has to cover the wait, not only the process.

2. One stuck exec is a permanent outage of the whole channel. The worker should give up on an exec that outlives its timeout, record the failure, and take the next one. A single bad command must not be able to take a node's exec channel offline until somebody restarts the agent, especially when the rule is never to stop hydranode.

What the node did NOT do

  • it did not go offline
  • it did not stop reporting scales
  • it did not log anything about the stuck exec after the request line
  • DELETE /api/v1/nodes/{id}/exec/queue cleared the 12 queued items but, correctly and by its own documentation, did not touch the in-flight one

The way out

hydracluster exec <node> --shell uses the PTY channel over a different websocket and was unaffected. That is what unblocked the deploy, and it is worth saying in the runbook: when exec times out but the node is online and reporting, reach for --shell before suspecting the node.

Suggested fix

  • enforce the request timeout on the whole wait, not the process, and use a context with a hard deadline around the output read
  • on timeout, post a failed result for that exec ID so the server stops counting it in flight, then continue the loop
  • log the exec id and the command when a request times out, so the log shows the stuck one rather than falling silent
  • expose the in-flight exec and how long it has been in flight in GET /api/v1/nodes/{id}/exec/queue, so this is one call to diagnose instead of a log hunt

How to reproduce, carefully

The trigger was a loop of incus exec <scale> -- grep -rl <pattern> /root/ 2>/dev/null | head -3 across three scales, sent as one exec. The head closing the pipe early is the suspect. The containers were 18 to 107 MB, so this was not a slow search: it ended quickly and the agent stayed blocked.

Do not reproduce this on a node that matters.

Session Context

Venue
fti-experience-zone

Comments (1)

api 14 Oct 2026 22:26

Still wedged 100 minutes later, on a node that is otherwise completely healthy:

GET /api/v1/nodes/node-50ab5309/exec/queue
{"in_flight":1,"items":[],"queued":0}

in_flight: 1 is the same exec from 22:27:33. Heartbeats, scale reporting and every service on the node have been fine throughout, and the agent has served a dozen PTY shell sessions in the meantime, so only the exec worker is dead. It does not recover on its own.

Two deploys, a config change and a service restart were done through hydracluster exec <node> --shell instead, which works normally. Nothing was lost; the channel is simply gone until hydranode restarts, which the standing rule says not to do.

One more thing for the fix list: a queued exec that is never dequeued stays queued for ever and will run whenever the worker recovers, which could be hours later and long after it stopped being a good idea. DELETE /exec/queue before walking away. A queue entry should expire on its own timeout the same way the in-flight one should.