-
-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Describe the bug
This is driving me crazy and unfortunately I still haven't found a way to reproduce consistently. My application creates date-based jobs and each job is responsible to create the next, as the interval vary and cant be expressed as a cron statement.
Unfortunately after a while this process breaks because the date-based job would not fire. I added logs at the very beginning of the job function to check if that is invoked, as well as wrapping the whole logic in try/catch to prevent that an error on our side would somehow break the job but had no luck, as even the log on the very first line of the job function would not be printed. The challenging part is that the behavior shows up sometimes after 2-3 cycles, other times after 10+ (which would mean after few days of continuos execution)
The example below is a dump of the jobs available in the scheduledJobs, showing for each the result of job.nextRun() and job.previousRun(). In the example below, the props are respectively job.name, job.getOnce(), job.getPattern(), job.nextRun() and job.previousRun(). The dump was taken at around 2026-02-12T03:00:00.000Z a time when event-a and event-c should have run already.
event-c is the job that never fired, so basically with no previous or next run.
{
"jobs": [
{
"name": "periodic-sync",
"once": null,
"pattern": "*/10 * * * *",
"next": "2026-02-12T06:40:00.000",
"previous": "2026-02-12T06:30:00.010"
},
{
"name": "event-a",
"once": "2026-02-12T01:36:00.000Z",
"next": null,
"previous": "2026-02-12T05:36:00.000"
},
{
"name": "event-b",
"once": "2026-02-12T08:35:00.000Z",
"next": "2026-02-12T12:35:00.000",
"previous": null
},
{
"name": "event-c",
"once": "2026-02-12T01:45:00.000Z",
"next": null,
"previous": null
}
]
}
To Reproduce
At this time i dont have clear reproduction steps but im open to suggestions how to troubleshoot croner internals.
Expected behavior
event-c should have fired at 2026-02-12T01:45:00.000Z.
System:
- OS: linux
- Runtime: nodejs
- Runtime Version: 20
- Croner Version: 10.0.1