Skip to content

Fix failed reboot silently starting a second parallel capture in continuous mode#919

Open
Cybis320 wants to merge 2 commits into
prereleasefrom
check-reboot-cmd-exit-code
Open

Fix failed reboot silently starting a second parallel capture in continuous mode#919
Cybis320 wants to merge 2 commits into
prereleasefrom
check-reboot-cmd-exit-code

Conversation

@Cybis320

@Cybis320 Cybis320 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

reboot_after_processing runs os.system('sudo shutdown -r now') without checking the exit code. When the command fails (e.g. no sudo rights under a systemd service user), the failure is invisible and capture resumes — but runCapture had returned with the old BufferedCapture still running, so a second capture starts in parallel. Every frame is then saved twice, and the old capture (holding a stale daytime_mode) labels its copies with the wrong _d/_n suffix. The interleaved duplicates shatter timelapse block grouping into 1–2 frame blocks that fail the 10-image minimum, are never cleaned up, and get rescanned every night (observed on a live station: ~96k warnings and a 40 MB log per night).

Two changes:

  • Check the reboot command's exit status; on failure log an error and give up instead of silently retrying 240 times.
  • In continuous mode, stop the capture before runCapture returns for the reboot, so a failed reboot can never leave two captures running.

Cybis320 added 2 commits July 2, 2026 18:18
os.system('sudo shutdown -r now') never raises on command failure, so a
failed reboot (e.g. no sudo rights under a systemd service user) was
silently retried 240 times in a few seconds before capture resumed.
Log an error with the exit code and stop retrying, since a permission
failure will not heal on retry.
runCapture returned with BufferedCapture still running, relying on the
imminent reboot to kill it. If the reboot failed, the resume path
started a second capture in parallel: every frame was saved twice, and
the old capture (holding the previous daytime_mode) stamped a stale
day/night suffix on its copies. The interleaved _d/_n duplicates then
shattered timelapse block grouping into 1-2 frame blocks that fail the
10-image minimum and are rescanned every night.
@Cybis320 Cybis320 requested a review from g7gpr July 3, 2026 01:21
@Cybis320 Cybis320 marked this pull request as ready for review July 6, 2026 14:43
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