node-cron: Error: Something went wrong. cron reached maximum iterations.
We got the following error message:
Error: Something went wrong. cron reached maximum iterations.
Along with it, there was this string:
Time Zone: "" - Cron String: 0,15,30,45 * * * * * - UTC offset: +00:00 - current Date: Wed Feb 12 2020 04:07:14 GMT+0000
It’d be great if you guys can let me know some whereabouts of it; would be helpful in finding the side effects of the said error. Thanks.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 44 (3 by maintainers)
Commits related to this issue
- GH-467 GH-478 GH-469 GH-470 GH-497 GH-498 - Allow soft warning when a hard error isn't required. Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com> — committed to kelektiv/node-cron by ncb000gt 4 years ago
- GH-467 GH-478 GH-469 GH-470 GH-497 GH-498 - Allow soft warning when a hard error isn't required. Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com> — committed to kelektiv/node-cron by ncb000gt 4 years ago
- GH-467 GH-478 GH-469 GH-470 GH-497 GH-498 - Allow soft warning when a hard error isn't required. Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com> — committed to kelektiv/node-cron by ncb000gt 4 years ago
- GH-467 GH-478 GH-469 GH-470 GH-497 GH-498 - Allow soft warning when a hard error isn't required. Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com> — committed to kelektiv/node-cron by ncb000gt 4 years ago
- Bump version to v2.0.4 Changelog: More error handling in getNextScheduledTime() to handle https://github.com/kelektiv/node-cron/issues/467 related issues. — committed to oh2th/fi.oh2th.alarmutils by oh2th a year ago
- Bump version to v2.0.5 Changelog: Try to catch errors from cron library related to https://github.com/kelektiv/node-cron/issues/467 — committed to oh2th/fi.oh2th.alarmutils by oh2th a year ago
- Try to catch errors from cron library related to https://github.com/kelektiv/node-cron/issues/467 — committed to oh2th/fi.oh2th.alarmutils by oh2th a year ago
- FIX: Update crom to 2.4.1 hopefully fixing kelektiv/node-cron#467 — committed to oh2th/fi.oh2th.alarmutils by oh2th 10 months ago
- Bump version to v2.1.2 Changelog: FIX: Update crom to 2.4.1 hopefully fixing kelektiv/node-cron#467 — committed to oh2th/fi.oh2th.alarmutils by oh2th 10 months ago
- update cron dependency relating to issue https://github.com/kelektiv/node-cron/issues/467 — committed to richardflint/walletstash-dca by richardflint 5 months ago
- Fix cron (#11) * update cron dependency relating to issue https://github.com/kelektiv/node-cron/issues/467 — committed to richardflint/walletstash-dca by richardflint 5 months ago
Context: I was interested in finding a way to reproduce the high server load situation to make the tests fail on purpose, enabling debugging the issue and opening the way to find a solution to this issue (when caused by server load).
I tried running tests with very limited resources (to simulate the server being under high load), and as expected this error was thrown multiple times (on 11 tests out of 125 total).
Command used to run the tests:
systemd-run --scope -p MemoryMax=64M -p MemoryHigh=52M -p CPUQuota=1% --user npm run testList of all the tests that failed
crontime › should generate the right next days when cron is set to every 15 mincrontime › should work around time zone changes that shifts time back (1)crontime › should work around time zone changes that shifts time forwardcrontime › Should schedule jobs inside time zone changes that shifts time forward to the end of the shift, for weekly jobscrontime › Should schedule jobs inside time zone changes that shifts the time forward to the end of the shift, for daily jobscrontime › Should schedule jobs inside time zone changes that shifts the time forward to the end of the shift, for hourly jobscrontime › should generate the right N next days for * * * * *crontime › should generate the right N next days for 0 0 9 * * *crontime › should generate the right N next days for 0 0 * * * with a time zonecrontime › should generate the right N next days for */3 * * * * with a time zonecrontime › should test valid range of months (*/15 * * 6-11 *)Hey there! As stated above, we released a fix for this issue in
v2.4.1🎉We expect this change to fix the majority of cases you encountered, which we believe were mostly related to low resources environments.
Please update to that version, and open a new issue if you encounter a similar issue again (if no one opened one already).
nice! I wonder if there’s a way to detect high system load a little better than just our own app taking a long time and then notify the user of that issue. previously a soft failure was considered which I feel is better than our app forcing a crash. that leaves room for recovery and hopefully successful execution of future jobs. as long as we notify the user that there was a failure and as long as we can “catch up” once there are more resources I would prefer that
No, the error is still there, and every time it gets stuck here and then reports the error
[92%] sealing (asset processing TerserPlugin)We just add this issue overnight with code both in prod and that could be reproduced in local. The same code was running fine previously. Commenting one the call solved the issue.
(note: we are using “@nestjs/schedule”: “^2.2.0” which is using “cron”: “2.2.0”)
And the crash disappeared by itself… might be related to hour change in my region…
This can’t really be fixed without a major refactor.
Take a look at
_getNextDateFrom