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

bugfix: protect the job function's waitgroup with a mutex to avoid race conditions #512

Merged
merged 1 commit into from Jun 9, 2023

Conversation

JohnRoesler
Copy link
Contributor

What does this do?

a possible race condition could occur with the job function's sync.WaitGroup being accessed from multiple goroutines

  • the initial creation (in the scheduler goroutine)
  • the adding within the executor goroutine)
  • the waiting within the executor stop goroutine (which could be different from the scheduler stop if stop is called from another goroutine by the user)

Which issue(s) does this PR fix/relate to?

resolves #507

List any changes that modify/break current functionality

Have you included tests for your changes?

Did you document any new/modified functionality?

  • Updated example_test.go
  • Updated README.md

Notes

@JohnRoesler JohnRoesler merged commit fed28e8 into main Jun 9, 2023
6 checks passed
@JohnRoesler JohnRoesler deleted the bugfix-race-executor-2 branch June 9, 2023 19:59
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

Successfully merging this pull request may close these issues.

Race Condition in job scheduler
1 participant