From e97a289722f6296498cb353412560ad9a91f66e6 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 2 Jun 2026 10:48:09 +0000 Subject: [PATCH] fix(node-agent): handle bridge spawn ENOENT + add pid:host for process detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs causing deltacast recorder 500s: 1. startDeltacastBridge() had no proc.on('error') handler — ENOENT when deltacast-bridge binary not in container PATH crashed the entire node-agent process (unhandled error event). Added error handler that logs and clears _dcBridge so the sidecar start continues. 2. node-agent container lacked pid:host — _dcBridgeProcessAlive() scans /proc but without host PID namespace it only sees container PIDs, so it always returned false and tried to re-spawn the bridge (hitting bug 1). pid:host lets the /proc scan see the host's deltacast-bridge systemd process. 🤖 Generated with Claude Code --- docker-compose.worker.yml | 1 + services/node-agent/index.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/docker-compose.worker.yml b/docker-compose.worker.yml index 278cc07..4592f94 100644 --- a/docker-compose.worker.yml +++ b/docker-compose.worker.yml @@ -43,6 +43,7 @@ services: build: ./services/node-agent restart: unless-stopped network_mode: host + pid: host environment: MAM_API_URL: ${MAM_API_URL} NODE_TOKEN: ${NODE_TOKEN:-} diff --git a/services/node-agent/index.js b/services/node-agent/index.js index 6a8906d..f702c3b 100644 --- a/services/node-agent/index.js +++ b/services/node-agent/index.js @@ -145,6 +145,11 @@ function startDeltacastBridge() { } }); + proc.on('error', (err) => { + console.error(`[dc-bridge] spawn error: ${err.message} (binary=${DC_BRIDGE_BIN})`); + _dcBridge = null; + }); + proc.on('exit', (code, sig) => { console.error(`[dc-bridge] exited code=${code} signal=${sig}`); _dcBridge = null;