Healthchecks: do not ping "[successful] finish" state after warning/error occured #888
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#888
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I'm using healthchecks.io (and its status-badge PNG) to monitor the success of my backups.
When where is an error/warning during backup, borgmatic pings the healthchecks "fail" endpoint. This is correct: healthchecks sends an alert, and its status-badge turns to red. This is exactly how it should work.
Some seconds later, when the backup task completes, borgmatic pings healthchecks again, now to the "finish" endpoint. This makes healthchecks think the failure-state has recovered: it sends an "recovered" alert, and the status-badge PNG turns back to green.
Steps to reproduce
Actual behavior
Ping #305 (received via the /fail endpoint)
2024-06-20T02:20:52.294315+00:00:
ssh://[redacted].your-storagebox.de:23/./borg: Error running actions for repository
Command 'borg prune --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --glob-archives {hostname}-* ssh://[redacted].your-storagebox.de:23/./borg' returned non-zero exit status 2
Ping #306: OK
2024-06-20T02:53:35.110450+00:00
Expected behavior
After an error occured (and healthchecks "fail" endpoint was pinged), bormatic should not ping healthchecks after the backup finished, or include status code in finish endpoint (see https://healthchecks.io/docs/signaling_failures/ )
Other notes / implementation ideas
No response
borgmatic version
1.7.7
borgmatic installation method
Debian package
Borg version
borg 1.2.4
Python version
Python 3.11.2
Database version (if applicable)
No response
Operating system and version
Debian GNU/Linux 12 (bookworm)
Interesting... I've looked at the code in question from borgmatic 1.7.7, and the behavior you're seeing shouldn't be possible. However there is a theoretical code path where the following related scenario can happen:
(Note that this same scenario does not work the same way in newer versions of borgmatic.)
So are you sure about the "fail" then "finish" ordering?
Also can I get a look at your (redacted) borgmatic logs? That might help pinpoint what's going on. Thanks!
While collecting logs (see attachment), I realized that borgmatic seemed to start twice on this host: once via
/etc/crontaband once via systemd.timer.This should explain the cause of the error (could not aquire exclusive lock) and also the order of the healthchecks ping events.
So I deleted the crontab-line and close this issue.
Wow, good sleuthing! I'm glad to hear that resolved it.