go-co-op / gocron

Easy and fluent Go cron scheduling. This is a fork from https://github.com/jasonlvhit/gocron
MIT License
5.69k stars 308 forks source link

[BUG] - CPU spike / max-out in One-time job when 2 or more equal times are provided #778

Closed rbroggi closed 2 months ago

rbroggi commented 2 months ago

Describe the bug

The scheduler CPU usage spikes (suggesting an infinite loop) when one or more equal times are used.

Below the flamegraph screenshot that shows that the whole application is allocating all the CPU to the scheduler:

image

Specifically the problem seems to lie on selectExecJobsOutForRescheduling

To Reproduce

When creating schedule using JobDefinition OneTimeJob and providing two at times at the same time.

Version

2.11

Expected behavior

No spike in memory, duplicate same items

Additional context