-
Notifications
You must be signed in to change notification settings - Fork 782
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
prevent dependencies from being added after stop #1898
Conversation
|
A Nomad user reported an issue where `View.poll` goroutines were being leaked when using large templates. When the runner's `Run` method is in-flight and the runner concurrently receives `Stop`, it's possible for the watcher to stop dependencies via stop and then immediately recreate them. Because the `Stop` method has returned, the caller will assume that all goroutines have been stopped, and this causes the `View.poll` goroutines to be leaked. The race condition for this case is very narrow, but is most likely to occur when the user has both a very large number of dependencies, short secret leases, and the `Wait` configuration is nil. Add a `stopped` flag to the `Watcher` which is set on `Stop`, and check whether this field has been set before adding a new dependency.
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!
Released in 0.37.4. Updated in Nomad here: hashicorp/nomad#20234 |
A Nomad user reported an issue where
View.poll
goroutines were being leaked when using large templates. When the runner'sRun
method is in-flight and the runner concurrently receivesStop
, it's possible for the watcher to stop dependencies via stop and then immediately recreate them. Because theStop
method has returned, the caller will assume that all goroutines have been stopped, and this causes theView.poll
goroutines to be leaked. The race condition for this case is very narrow, but is most likely to occur when the user has both a very large number of dependencies, short secret leases, and theWait
configuration is nil.Add a
stopped
flag to theWatcher
which is set onStop
, and check whether this field has been set before adding a new dependency.Ref: hashicorp/nomad#20163