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

[BUG] Cronjob executed earlier than expected, and executed twice #409

Closed
shieldnet opened this issue Dec 26, 2022 · 3 comments
Closed

[BUG] Cronjob executed earlier than expected, and executed twice #409

shieldnet opened this issue Dec 26, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@shieldnet
Copy link

shieldnet commented Dec 26, 2022

Describe the bug

What I did

  • I registered a cronjob with cron expression with second (0 50 9 * * *) for daily job execution.
// simplified code
var s *gocron.Scheduler = gocron.NewScheduler()
s.CronWithSeconds("0 50 9 * * *").Do(func() {
   // job functions
})
s.StartAsync()
  • My program executed for about three days (12/23 19:00 GMT+9 ~ 12/26 16:00 GMT+9)

What actually happened

  • Cronjobs which are scheduled on 12/24 09:50:00 and 12/25 09:50:00 executed exactly on expected time.
  • But, job schdueled 12/26 09:50:00 suddenly executed on 12/26 09:48:58.906632. and After the earlier job finished, the job scheduled on 12/26 09:50:00 executed twice.
  • Only 12/26 09:50:00 job executed twice and earlier than expected.

To Reproduce

  • I can not assure that this bug can be reporduced.

Steps to reproduce the behavior:

  1. register cronjob with cron expression
  2. start async

Version

  • go1.18.3

Expected behavior

  • Just one execution of cronjob, at 09:50:00 AM (or, a few seconds after schedule).

Additional context

  • NA
@shieldnet shieldnet added the bug Something isn't working label Dec 26, 2022
@yqchilde
Copy link

I also have a similar problem. In my project, execution is occasionally triggered twice. This problem exists in v1.18.0.

@fufuok
Copy link

fufuok commented Feb 13, 2023

Maybe related to #393?

@JohnRoesler
Copy link
Contributor

I ran a cron job every hour on the 30 min mark for a couple days and didn't observe this issue. Is anyone here still seeing it occur?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants