Skip to content

fix(compose): restart the engine when its log goes stale - #419

Closed
MateoLostanlen wants to merge 5 commits into
developfrom
fix/heartbeat-signal-deadlock
Closed

MateoLostanlen wants to merge 5 commits into
developfrom
fix/heartbeat-signal-deadlock

Conversation

@MateoLostanlen

@MateoLostanlen MateoLostanlen commented Sep 12, 2026 •

Copy link
Copy Markdown
Member
  • On 2026-09-11 the kwartier-west engine froze for 26 h with Docker still reporting it healthy. The current healthcheck only greps engine.log for a line that was logged once, so a hung process stays healthy forever, and Docker never restarts an unhealthy container by itself.
  • The healthcheck now checks that engine.log moved in the last 70 min (the loop logs every pass and the night sleep is 60 min). When it did not, it kills every process but PID 1, so the pipeline exits and restart: always brings the engine back.
  • The heartbeat deadlock itself was fixed in feat(engine): one heartbeat per camera per minute #420, this PR only keeps the safety net for any other hang.

@codecov

codecov Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.02%. Comparing base (3a4b74e) to head (d6d906c).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #419   +/-   ##
========================================
  Coverage    80.02%   80.02%           
========================================
  Files            6        6           
  Lines          846      846           
========================================
  Hits           677      677           
  Misses         169      169           
Flag Coverage Δ
unittests 80.02% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MateoLostanlen MateoLostanlen changed the title fix(engine): drop the SIGALRM heartbeat cutoff that can deadlock the loop fix(compose): restart the engine when its log goes stale Oct 22, 2026
@MateoLostanlen

Copy link
Copy Markdown
Member Author

Tested on pi-test (Pi 5, Debian 13, Docker 29), branch develop + #419 + #459 + #461, images built on the Pi.

Engine frozen, healthcheck restarts it: OK

  • Fault: kill -STOP on the python and tee processes from the host, then engine.log mtime set 2 h back to skip the 70 min wait.
  • Seen: frozen at 11:28:16, the next healthcheck (11:28:22) found the log stale, Killed in the log, engine back and healthy at 11:28:22.

Remark: the kill is inside the healthcheck command, so it fires on the first failed check and retries: 3 has no effect here. Fine, but worth a comment in the compose.

Side finding on develop: build: context: ./engine points to a folder that does not exist, so docker compose build fails on a Pi (CI and the Makefile build from .).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant