Browse Source

pubsub: Report a non-nil error when shutting down. (#7309)

If a subscriber arrives while the pubsub service is shutting down, the existing
code will return a nil subscription without error. With unlucky timing, this
may lead to a nil indirection panic in the RPC service.

To avoid that problem, make sure that when a subscription fails for this
reason, we report a non-nil error so that the client will detect it and give up
gracefully.
pull/7371/head
M. J. Fromberger 3 years ago
committed by GitHub
parent
commit
9994396e59
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions
  1. +2
    -1
      CHANGELOG_PENDING.md
  2. +1
    -1
      libs/pubsub/pubsub.go

+ 2
- 1
CHANGELOG_PENDING.md View File

@ -10,7 +10,7 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
- CLI/RPC/Config
- [config] \#7230 rpc: Add experimental config params to allow for subscription buffer size control (@thanethomson).
- [config] [\#7230](https://github.com/tendermint/tendermint/issues/7230) rpc: Add experimental config params to allow for subscription buffer size control (@thanethomson).
- Apps
@ -26,5 +26,6 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
### BUG FIXES
- [\#7309](https://github.com/tendermint/tendermint/issues/7309) pubsub: Report a non-nil error when shutting down (fixes #7306).
- [\#7057](https://github.com/tendermint/tendermint/pull/7057) Import Postgres driver support for the psql indexer (@creachadair).
- [\#7106](https://github.com/tendermint/tendermint/pull/7106) Revert mutex change to ABCI Clients (@tychoish).

+ 1
- 1
libs/pubsub/pubsub.go View File

@ -194,7 +194,7 @@ func (s *Server) subscribe(ctx context.Context, clientID string, query Query, ou
case <-ctx.Done():
return nil, ctx.Err()
case <-s.Quit():
return nil, nil
return nil, errors.New("service is shutting down")
}
}


Loading…
Cancel
Save