From cad1e52c38f41c3125a02c1c8d6d94329b384982 Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Mon, 1 Jun 2026 19:32:01 -0400 Subject: [PATCH] fix(deltacast-bridge): reset signal-wait deadline AFTER acquiring flock The signal timeout deadline was set at process start before waiting for the flock. Bridges queued behind earlier ports waited minutes for the lock, then found their 30s signal deadline had already expired before they even opened the board, causing false "no signal" failures on ports that have live signal. Fix: move clock_gettime deadline initialisation to AFTER flock acquired and board opened, so the full sig_timeout is always available for signal detection regardless of queue wait time. --- services/capture/deltacast-bridge/main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/capture/deltacast-bridge/main.c b/services/capture/deltacast-bridge/main.c index f9176ba..b36dd6f 100644 --- a/services/capture/deltacast-bridge/main.c +++ b/services/capture/deltacast-bridge/main.c @@ -280,7 +280,11 @@ int main(int argc, char *argv[]) { * (already bind-mounted into every capture sidecar) to guarantee only * one bridge runs OpenBoardHandle + signal-wait at a time. The lock is * released after signal lock succeeds (plus a settle delay) or on - * failure — so the next bridge is never permanently blocked. */ + * failure — so the next bridge is never permanently blocked. + * + * IMPORTANT: the signal-wait deadline is set AFTER acquiring the lock so + * the full sig_timeout is available for signal detection regardless of + * how long this bridge waited in the queue. */ const char *lock_path = "/dev/shm/deltacast/bridge.lock"; int lock_fd = open(lock_path, O_CREAT | O_RDWR, 0666); if (lock_fd >= 0) { @@ -313,7 +317,9 @@ int main(int argc, char *argv[]) { VHD_SetBoardProperty(board, loopback_prop(port_id), FALSE); } - /* ── Wait for signal lock ──────────────────────────────────────── */ + /* ── Wait for signal lock ────────────────────────────────────────── + * Deadline is set HERE — after the flock is acquired and the board is + * open — so the full sig_timeout is available regardless of queue wait. */ ULONG video_std = (ULONG)NB_VHD_VIDEOSTANDARDS; struct timespec deadline; clock_gettime(CLOCK_MONOTONIC, &deadline);