question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cron reached maximum iterations

See original GitHub issue

On this weekend my application started to crash for no reason on AWS. Maybe it is related to the beginning of summer time in Brazil. Because there wasn’t any code changes.

I am getting this error:

Please open an  issue (https://github.com/kelektiv/node-cron/issues/new) and provide the following string
Time Zone: "" - Cron String: 0 0 0 * * * - UTC offset: -03:00 - current Date: Sat Nov 03 2018 08:00:16 GMT+0000
  at CronTime._getNextDateFrom (/srv/api/node_modules/cron/lib/cron.js:243:12)
  at CronTime.sendAt (/srv/api/node_modules/cron/lib/cron.js:151:17)
  at CronTime.getTimeout (/srv/api/node_modules/cron/lib/cron.js:170:29)
  at CronJob.start (/srv/api/node_modules/cron/lib/cron.js:561:31)
  at new CronJob (/srv/api/node_modules/cron/lib/cron.js:524:10)
  at createJob (/srv/api/src/app/jobs/AutoArchiveDoneTasksJob.js:57:14)
  at Function.define (/srv/api/src/app/jobs/AutoArchiveDoneTasksJob.js:65:21)
  at /srv/api/node_modules/node-injectjs/src/core/define.js:44:24
  at process._tickDomainCallback (internal/process/next_tick.js:129:7)

And I am using the lib this way:

module.exports = function (fnResolve) {
  "use strict";

  define([
    '$cron'
  ], ({ CronJob }) => {

    function onTick() {
      // do the stuff I need
    }

    function createJob(hour, onTick) {
      return new CronJob({
        cronTime: `00 00 ${hour} * * *`,
        onTick,
        start: true,
        timeZone: 'America/Sao_Paulo'
      });
    }

    const MainJob = createJob('00', onTick);

    const AuxJob = createJob('06', onTick); // just in case the server was not able to run at 0h

    fnResolve({
      MainJob,
      AuxJob
    });
  });
};

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
jodevsacommented, Nov 6, 2018

Hi @lucasbraum ,

Thank you for reporting this issue. You are right, this is related to DST changes for Sao_Paulo and have been previously reported in #381 and thought to be fixed. This is related to an unexpected behavior of a dependency used for timezone handling moment-timezone which we haven’t figured out all cases were this might occur. I’ve pushed a fix to another branch DST-handeling-revamp that you can try out (will push to master after more tests related to DST are added)

0reactions
lucasbraumcommented, Nov 6, 2018

Could fixed it by upgrading to version 1.5.0.

Thanks for the support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Something went wrong. cron reached maximum iterations #408
Just started today. Error: Something went wrong. cron reached maximum iterations. Please open an issue (https://github.com/kelektiv/node-cron ...
Read more >
Something went wrong. cron reached maximum iterations.
Error: Something went wrong. cron reached maximum iterations. Please open an issue (https://github.com/kelektiv/node-cron/issues/new) and ...
Read more >
Solved Cloudron 5.3.3 crashed for me, unclear why.
... Error: Something went wrong. cron reached maximum iterations. Please open an issue (https://github.com/kelektiv/node-cron/issues/new) ...
Read more >
Node-cron - Red crashed, does it need a bump in package ...
... Exception: Mar 9 02:55:00 myPi512 Node-RED[5459]: 9 Mar 02:55:00 - Error: Something went wrong. cron reached maximum iterations.
Read more >
Error: Something went wrong. cron reached maximum iterations.
Error: Something went wrong. cron reached maximum iterations. #608. Open. kennycharles opened this issue Apr 28, 2022 · 1 comment.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found