-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Race condition in push monitors #1422
Comments
The race condition is caused because the monitor is running on a This is partly an issue because Because of the behavior of uptime-kuma/server/model/monitor.js Lines 309 to 329 in 12237de
uptime-kuma/server/model/monitor.js Lines 468 to 475 in 12237de
uptime-kuma/server/routers/api-router.js Lines 20 to 84 in 12237de
I would recommend following the approach of healthchecks. Healthchecks waits for the first "ping" (aka push URL call), then 60s after that ping, checks again to make sure another ping has happened. There is also a grace period to accommodate clock differences. For example, if you have a 5s grace time, the monitor won't be marked as down unless 65s has elapsed since the last ping. I think the right thing to do, though it may be a little difficult with the way you have the architecture set up, is to do the first |
technically this is still not finished yet until #1428 is finished and gets merged! |
It was closed automatically. Sounds horrible because it could be cross repo. |
Synchronize push monitor heartbeats to api calls (fixes #1422)
🛡️ Security Policy
Description
There is a race condition in the code for push monitors that can cause repeat notifications within the same second or shortly thereafter. (see some background in #922)
http logs show that the GET calls are generally 60s apart, but because of discrepancies in system time down to the ms level, it can appear that they happen a second apart, even if they're very close together (ie.e 17:58:05.999 to 17:59:06.000)
👟 Reproduction steps
Repro is tricky, but it could be possible by monitoring uptime kuma debug logs and synchronizing to them. Basically, the push URL calls have to happen just shortly after the monitor's calls to
beat()
orsafe_beat()
👀 Expected behavior
Uptime kuma should be robust against very small clock discrepancies
😓 Actual Behavior
Get double notifications
🐻 Uptime-Kuma Version
1.12.1
💻 Operating System and Arch
Docker on Ubuntu 20.04
🌐 Browser
Firefox
🐋 Docker Version
Latest
🟩 NodeJS Version
No response
📝 Relevant log output
No response
The text was updated successfully, but these errors were encountered: