Skip to content

Commit

Permalink
Merge #59381 #59385
Browse files Browse the repository at this point in the history
59381: stop: ensure Closer called exactly once r=nvanbenschoten a=tbg

Due to a bug introduced in #59041, `AddCloser` could add a closer that
would never be called in the event that the closer was concurrently
Stop'ping. This commit fixes it.

Fixes #59368.

Release note: None


59385: build,bazel: delete stale references breaking bazel build r=rickystewart a=rickystewart

These dependencies marked `keep` aren't actually necessary any more and
now introduce cyclic dependency errors, so remove them.

Release note: None

Co-authored-by: Tobias Grieger <[email protected]>
Co-authored-by: Ricky Stewart <[email protected]>
  • Loading branch information
3 people committed Jan 25, 2021
3 parents bf439cd + 1a27b4b + d49f45c commit 1aa232c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion pkg/jobs/jobspb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ go_proto_library(
visibility = ["//visibility:public"],
deps = [
"//pkg/ccl/streamingccl", # keep
"//pkg/ccl/streamingccl/streamclient", # keep
"//pkg/roachpb",
"//pkg/security", # keep
"//pkg/sql/catalog/descpb",
Expand Down
1 change: 0 additions & 1 deletion pkg/sql/execinfrapb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//pkg/base",
"//pkg/ccl/streamingccl/streamclient", # keep
"//pkg/roachpb",
"//pkg/rpc",
"//pkg/security",
Expand Down
7 changes: 3 additions & 4 deletions pkg/util/stop/stopper.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,11 @@ func (s *Stopper) Recover(ctx context.Context) {
func (s *Stopper) AddCloser(c Closer) {
s.mu.Lock()
defer s.mu.Unlock()
select {
case <-s.stopped:
if s.mu.stopCalled {
c.Close()
default:
s.mu.closers = append(s.mu.closers, c)
return
}
s.mu.closers = append(s.mu.closers, c)
}

// WithCancelOnQuiesce returns a child context which is canceled when the
Expand Down

0 comments on commit 1aa232c

Please sign in to comment.