Skip to content

Commit

Permalink
Fix race in reload and gateway sublist check
Browse files Browse the repository at this point in the history
Signed-off-by: Waldemar Quevedo <wally@nats.io>
  • Loading branch information
wallyqs committed May 3, 2023
1 parent 91607d8 commit 1b892a9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/gateway.go
Expand Up @@ -2680,7 +2680,10 @@ func (s *Server) gatewayHandleSubjectNoInterest(c *client, acc *Account, accName
// If there is no subscription for this account, we would normally
// send an A-, however, if this account has the internal subscription
// for service reply, send a specific RS- for the subject instead.
// Need to grab the lock here since sublist can change during reload.
acc.mu.RLock()
hasSubs := acc.sl.Count() > 0
acc.mu.RUnlock()
if !hasSubs {
acc.mu.RLock()
hasSubs = acc.siReply != nil
Expand Down

0 comments on commit 1b892a9

Please sign in to comment.