Local node executor is never recycled after invoke timeouts; a wedged process stalls all Node actions until container restart
Setup. Self-hosted convex-backend (docker ghcr.io/get-convex/convex-backend), Postgres, one deployment per container, APPLICATION_MAX_CONCURRENT_NODE_ACTIONS=32, ~30 "use node" modules (LLM agents via @convex-dev/agent, sharp image resizing, Clerk/Autumn SDK calls).
What happened (2026-09-22, 19:50–20:22 UTC). The local node executor process (node local.cjs, spawned by crates/node_executor/src/local.rs) wedged while still accepting connections. From that point on every Node action — including ones that normally finish in <1s — ran until the 10-minute action timeout and completed with Function execution unexpectedly timed out / Transient error while executing action. Each timed-out invocation held a Node pool slot for 10 min, so the 32-slot pool saturated in under 2 minutes; interactive Node actions then waited the 10s semaphore timeout and failed with TooManyConcurrentRequests ("Your backend is limited to 32 concurrent actions"). Container CPU was ~256% and RSS ~15 GiB at the time. Nothing recovered by itself; docker restart of the container fixed it 32 min later. 209 scheduled jobs failed in the window.
Reconstructed from _scheduled_functions (scheduledTime → completedTime), e.g.:
generateResponseAsync 19:49:57 → 20:00:02 Transient error while executing action
createThread 19:52:14 → 20:02:31 Function execution unexpectedly timed out
generateMetadata 19:52:16 → 20:02:31 Function execution unexpectedly timed outWhy it didn't self-heal. In LocalNodeExecutor::invoke:
Err(e) => {
if e.is_timeout() {
return Ok(InvokeResponse { response: EXECUTE_TIMEOUT_RESPONSE_JSON.clone(), .. });
} else if e.is_connect() {
// Connection error likely means the Node server crashed (e.g., OOM).
// Drop the dead server so it will be restarted on next invoke.
self.inner.lock().await.take();
...The executor is only recreated on connection errors. A process that is alive but no longer makes progress (event loop blocked, heap thrash near the V8 limit, stuck native call) keeps the socket open, so every invocation times out and the same wedged process is reused forever. response_stream has the same shape: a timeout yields an error result but keeps inner.
Ask.
- Treat consecutive invoke timeouts as executor failure: after N (e.g. 3) timeouts with no successful completion in between,
self.inner.lock().await.take()(and kill the child) so the next invoke respawns it — mirroring theis_connect()branch. - Optionally a cheap liveness check (the existing
/healthendpoint, with a short timeout) run when a timeout is observed; if/healthitself times out, recycle immediately instead of waiting for N. - Related to #563: a lifetime / RSS bound on the executor would also have helped here, since the wedge coincided with high memory.
We're working around it with a host-side systemd timer that probes a trivial "use node" action and docker restarts the container after 3 misses (sebipap/render-a-house#849), but a backend that recycles its own executor would be much better than restarting the whole container (which also drops in-flight V8 work and websocket clients).
Happy to provide more logs / metrics if useful.
Source: get-convex/convex-backend