fix(cameras): self-healing healthcheck for neolink stalls

neolink can wedge with a full message channel: RTSP stays up but serves
no frames, so Frigate shows e1 offline indefinitely. Probe 30 RTP buffers
off the sub stream each minute; after 3 straight failures SIGKILL neolink
so the container exits and restart: unless-stopped brings it back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ginnoirandClaude Opus 5.5 committed 2026-10-08 22:43:12 -05:00
1 parent 985a6ddc43
commit 40b19c49f9
1 file changed
+19
+19
View File
@@ -44,6 +44,25 @@ services:
networks: [cameras] networks: [cameras]
volumes: volumes:
- /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
# 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
# neolink; the image's sh PID 1 then exits and `restart: unless-stopped` brings it back.
healthcheck:
test:
- CMD-SHELL
- >-
f=/tmp/hc-fails;
if timeout 20 gst-launch-1.0 -q rtspsrc location=rtsp://127.0.0.1:8554/e1/subStream protocols=tcp
! identity eos-after=30 ! fakesink >/dev/null 2>&1; then echo 0 > $$f; exit 0; fi;
n=$$(( $$(cat $$f 2>/dev/null || echo 0) + 1 )); echo $$n > $$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;
exit 1
interval: 60s
timeout: 30s
start_period: 60s
retries: 3
frigate: frigate:
image: ghcr.io/blakeblackshear/frigate:0.17.2 image: ghcr.io/blakeblackshear/frigate:0.17.2