fix(cameras): neolink healthcheck probes 300 main-stream buffers

A stalled neolink still bursts ~30 buffered packets on connect, so the
30-buffer sub-stream probe passed for an hour while Frigate crash-looped.
Healthy main stream delivers 300 buffers in ~4 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ginnoirandClaude Opus 5.5 committed 2026-10-09 00:23:58 -05:00
1 parent 40b19c49f9
commit 601a9d8545
1 file changed
+5 -3
+5 -3
View File
@@ -46,15 +46,17 @@ services:
- /config/neolink/neolink.toml:/etc/neolink.toml:ro - /config/neolink/neolink.toml:/etc/neolink.toml:ro
# neolink can wedge without exiting ("Remaining: 0 of 100 message space"): RTSP stays # neolink can wedge without exiting ("Remaining: 0 of 100 message space"): RTSP stays
# up but serves no frames, so Frigate shows the stream offline forever (2026-10-08). # up but serves no frames, so Frigate shows the stream offline forever (2026-10-08).
# Probe: pull 30 RTP buffers off the sub stream. After 3 straight failures, SIGKILL # A stalled stream still bursts ~30 buffered packets on connect, so 30 was a false pass
# for an hour (2026-10-09). Probe: pull 300 RTP buffers off the main stream (~4 s when
# healthy, ~80 pkt/s). After 3 straight failures, SIGKILL
# neolink; the image's sh PID 1 then exits and `restart: unless-stopped` brings it back. # neolink; the image's sh PID 1 then exits and `restart: unless-stopped` brings it back.
healthcheck: healthcheck:
test: test:
- CMD-SHELL - CMD-SHELL
- >- - >-
f=/tmp/hc-fails; f=/tmp/hc-fails;
if timeout 20 gst-launch-1.0 -q rtspsrc location=rtsp://127.0.0.1:8554/e1/subStream protocols=tcp if timeout 20 gst-launch-1.0 -q rtspsrc location=rtsp://127.0.0.1:8554/e1/mainStream protocols=tcp
! identity eos-after=30 ! fakesink >/dev/null 2>&1; then echo 0 > $$f; exit 0; fi; ! identity eos-after=300 ! fakesink >/dev/null 2>&1; then echo 0 > $$f; exit 0; fi;
n=$$(( $$(cat $$f 2>/dev/null || echo 0) + 1 )); echo $$n > $$f; n=$$(( $$(cat $$f 2>/dev/null || echo 0) + 1 )); echo $$n > $$f;
if [ $$n -ge 3 ]; then echo 0 > $$f; if [ $$n -ge 3 ]; then echo 0 > $$f;
for p in /proc/[0-9]*; do [ "$$(cat $$p/comm 2>/dev/null)" = neolink ] && kill -9 $${p#/proc/}; done; fi; for p in /proc/[0-9]*; do [ "$$(cat $$p/comm 2>/dev/null)" = neolink ] && kill -9 $${p#/proc/}; done; fi;