Details
-
Bug
-
Resolution: Fixed
-
Critical
-
7.1.0, 7.1.1
-
Untriaged
-
1
-
Yes
Description
What's the issue?
The crux of this issue is that our worker pool doesn't accept a context to handle clean teardown. In lieu of this, we have a context that we use to perform clean teardown.
// done - Handles the error returned by a worker, canceling the context if non-nil.
|
done := func(err error) error {
|
if err == nil {
|
return nil
|
}
|
|
cancel()
|
|
return err
|
}
|
The error here, is that the context is canceled prior to the error being returned; depending on how goroutines are scheduled, the error returned by the worker pool may be:
- This error
- Or the error returned by the worker that tears down first (which is likely to be <nil>)
What's the fix?
We should probably have the worker pool properly use contexts to support clean cancellation.