From a0d0daf0e1422e95be23600d5fb3e080ccd51108 Mon Sep 17 00:00:00 2001 From: Tobias Schottdorf Date: Tue, 4 Jun 2019 14:03:55 +0200 Subject: [PATCH] storage: avoid deadlock on (*Stopper).Quiesce See https://github.com/cockroachdb/cockroach/issues/37954#issuecomment-498451871. Closes #37954. Release note: None --- pkg/storage/closedts/provider/provider.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/storage/closedts/provider/provider.go b/pkg/storage/closedts/provider/provider.go index 0c7015d885b2..b841f730ea86 100644 --- a/pkg/storage/closedts/provider/provider.go +++ b/pkg/storage/closedts/provider/provider.go @@ -275,6 +275,8 @@ func (p *Provider) Subscribe(ctx context.Context, ch chan<- ctpb.Entry) { for _, entry := range entries { select { case ch <- entry: + case <-p.cfg.Stopper.ShouldQuiesce(): + return case <-ctx.Done(): return } @@ -324,6 +326,8 @@ func (p *Provider) Subscribe(ctx context.Context, ch chan<- ctpb.Entry) { select { case ch <- entry: + case <-p.cfg.Stopper.ShouldQuiesce(): + return case <-ctx.Done(): return }