Skip to content
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

Error: Something went wrong. cron reached maximum iterations. #467

Closed
Tracked by #674
shivam-postman opened this issue Feb 12, 2020 · 46 comments · Fixed by #686
Closed
Tracked by #674

Error: Something went wrong. cron reached maximum iterations. #467

shivam-postman opened this issue Feb 12, 2020 · 46 comments · Fixed by #686
Labels
released type:bug Bug reports and bug fixes

Comments

@shivam-postman
Copy link

shivam-postman commented Feb 12, 2020

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.

@mryellow
Copy link

#408

@pddivine
Copy link

pddivine commented May 4, 2020

I ran into the same issue as well:

Error: Something went wrong. cron reached maximum iterations. Please open an issue (https://github.com/kelektiv/node-cron/issues/new) and provide the following string Time Zone: "" - Cron String: 0,15,30,45 * * * * * - UTC offset: +00:00 - current Date: Mon May 04 2020 01:05:26 GMT+0000

ncb000gt added a commit that referenced this issue May 27, 2020
… hard error isn't required.

Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
@ncb000gt
Copy link
Member

I pushed up a PR with some changes to allow a "soft warning". Can you please test and report back?

ncb000gt added a commit that referenced this issue May 28, 2020
… hard error isn't required.

Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
ncb000gt added a commit that referenced this issue May 28, 2020
… hard error isn't required.

Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
ncb000gt added a commit that referenced this issue Jun 2, 2020
… hard error isn't required.

Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
@kasir-barati
Copy link

@pddivine @shivam-postman Can you give me a script which reproduce/potentially reproduce the same issue?

@intcreator
Copy link
Collaborator

has this been an problem since the move from Moment to Luxon? if not we can close this issue

@sheerlox
Copy link
Collaborator

sheerlox commented Jun 7, 2023

@intcreator are you referring to #499? While I definitely agree with you, at the same time the comment made by Nick about this also makes sense to me.
The only way I see (for now and with my limited knowledge of the codebase) to tackle this issue is to understand the conditions under which an infinite loop would exist and write safeguards specific to that. What do you think?

@intcreator
Copy link
Collaborator

yeah that's the issue I was referring to.

maybe instead of crashing we can restart the cron job with a warning? that way the infinite loop is prevented but the cron job can still be running afterward

oh2th added a commit to oh2th/fi.oh2th.alarmutils that referenced this issue Jun 9, 2023
Changelog: Try to catch errors from cron library related to kelektiv/node-cron#467
oh2th added a commit to oh2th/fi.oh2th.alarmutils that referenced this issue Jun 9, 2023
@cexedev
Copy link

cexedev commented Jul 12, 2023

Has anyone found the fix yet,
let resetNotificationFlagIfFailed = new CronJob(*/20 * * * * *, async function () { ... MY CODE HERE }, null, true, "Australia/Brisbane" );

This is how I've running a cronjob and this is the error i am getting
Error: Something went wrong. It took over five seconds to find the next execution time for the cron job. Please refer to the canonical issue (https://github.com/kelektiv/node-cron/issues/467) and provide the following string if you would like to help debug: Time Zone: "" - Cron String: 0,15,30,45 * * * * * - UTC offset: 600

@mryellow
Copy link

This package works in the cases where node-cron does not.

https://github.com/harrisiirak/cron-parser

I'd suggest moving to it entirely or replacing _getNextDateFrom with this library.

@jakguru
Copy link

jakguru commented Jul 14, 2023

Got this error: Error: Something went wrong. It took over five seconds to find the next execution time for the cron job.
Here's the string that it asked for:

Time Zone: "" - Cron String: 0 * * * * * - UTC offset: 0 - current Date: 2023-07-13T22:18:41.049+00:00
Node.js v18.16.1

@ncb000gt
Copy link
Member

🎉 This issue has been resolved in version 2.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sheerlox
Copy link
Collaborator

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).

@ncb000gt
Copy link
Member

🎉 This issue has been resolved in version 3.0.0-beta.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

oh2th added a commit to oh2th/fi.oh2th.alarmutils that referenced this issue Aug 18, 2023
oh2th added a commit to oh2th/fi.oh2th.alarmutils that referenced this issue Aug 18, 2023
Changelog: FIX: Update crom to 2.4.1 hopefully fixing kelektiv/node-cron#467
@sheerlox sheerlox added the type:bug Bug reports and bug fixes label Sep 8, 2023
richardflint added a commit to richardflint/walletstash-dca that referenced this issue Feb 7, 2024
richardflint added a commit to richardflint/walletstash-dca that referenced this issue Feb 7, 2024
* update cron dependency relating to issue kelektiv/node-cron#467
@olegktrnd
Copy link

I'm still encountering this issue. Here's what the full error looks like:

Error: Something went wrong. It took over five seconds to find the next execution time for the cron job.
                            Please refer to the canonical issue (https://github.com/kelektiv/node-cron/issues/467) and provide the following string if you would like to help debug:
                            Time Zone: "" - Cron String: 0,10,20,30,40,50 * * * * * - UTC offset: 0
                            - current Date: 2024-04-30T00:25:28.650+00:00
   at CT._getNextDateFrom (/opt/app/node_modules/cron/lib/time.js:272:12)
   at CT.sendAt (/opt/app/node_modules/cron/lib/time.js:185:17)
   at CT.getTimeout (/opt/app/node_modules/cron/lib/time.js:202:29)
   at CJ.start (/opt/app/node_modules/cron/lib/job.js:119:31)
   at Timeout.callbackWrapper [as _onTimeout] (/opt/app/node_modules/cron/lib/job.js:172:11)
   at listOnTimeout (node:internal/timers:564:17)
   at processTimers (node:internal/timers:507:7)>

My node-cron version is v3.0.3.
I get this error about 2-3 times a day. Any ideas what could be causing it?

@sheerlox
Copy link
Collaborator

sheerlox commented Apr 30, 2024

Hi, this bug was fixed (and the error message you shared was removed) in v2.4.1, so upgrading to (at least) that version will resolve your issue.

@dipakpandey7
Copy link

Screenshot 2024-09-20 at 9 22 38 AM (1)

My node-cron version is "cron": "^2.1.0",
I get this error about 2-3 times a day. Any ideas what could be causing in and how to solve this issue

@sheerlox
Copy link
Collaborator

@dipakpandey7 your version is probably pinned in your package manager lock file, so the same recommendation as above apply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released type:bug Bug reports and bug fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.