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

Race-condition when starting job schedule #604

Closed
Pharb opened this issue Jul 11, 2023 · 0 comments
Closed

Race-condition when starting job schedule #604

Pharb opened this issue Jul 11, 2023 · 0 comments

Comments

@Pharb
Copy link
Member

Pharb commented Jul 11, 2023

Problem

Jobs are sometimes no longer executed by configured schedule.

Workaround

After server restart, jobs are running again as expected.

Cause

The suspected problem is in SchedulePing.checkActiveSchedule(). When startAllJobs() takes longer than interval, a new iteration of checkActiveSchedule() will run and concurrently run startAllJobs(), since startedJobs is not yet set to true. This causes stop() to be run on the JobScheduler which sets the jobExecutor to stopped. This will prevent the jobExecutor to decrease its running counter at the end of its execute function.

To solve, either the stopped flag in the jobExecutor needs to be cleared during the start of the JobScheduler, or it needs to be made sure that the start function is only run once. Either way it would make sense to only allow one execution of checkActiveSchedule to run in parallel.

Reproduce

See #603 for a test case demonstrating this race-condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant