-
Notifications
You must be signed in to change notification settings - Fork 106
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
fix(scheduler): fix data race #2085
fix(scheduler): fix data race #2085
Conversation
af44c0c
to
9875fcc
Compare
18b72e3
to
8ea9c13
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2085 +/- ##
==========================================
+ Coverage 92.00% 92.06% +0.06%
==========================================
Files 165 165
Lines 28687 28681 -6
==========================================
+ Hits 26394 26406 +12
+ Misses 1697 1678 -19
- Partials 596 597 +1 ☔ View full report in Codecov by Sentry. |
23063eb
to
bfb9204
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
16096f1
bfb9204
to
16096f1
Compare
71e977e
71e977e
to
d86e4a1
Compare
d86e4a1
to
efd76c9
Compare
580f353
to
8781241
Compare
the problem here is that scheduler can be closed in two ways: - canceling the context given as argument to scheduler.RunScheduler() - running scheduler.Shutdown() because of this shutdown can trigger a data race between calling scheduler.inShutdown() and actually pushing tasks into the pool workers solved that by keeping a quit channel and listening on both quit channel and ctx.Done() and closing the worker chan and scheduler afterwards. Signed-off-by: Petu Eusebiu <[email protected]>
a123456
to
f3f8e4f
Compare
before this we could stop scheduler either by closing the context provided to RunScheduler(ctx) or by running Shutdown(). simplify things by getting rid of the external context in RunScheduler(). keep an internal context in the scheduler itself and pass it down to all tasks. Signed-off-by: Petu Eusebiu <[email protected]>
f3f8e4f
to
8b0b567
Compare
What type of PR is this?
Which issue does this PR fix:
What does this PR do / Why do we need it:
If an issue # is not available please add repro steps and logs showing the issue:
Testing done on this change:
Automation added to e2e:
Will this break upgrades or downgrades?
Does this PR introduce any user-facing change?:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.