mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
[FIXED] Fix for data race accessing consumer assignment (#4547)
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -4231,6 +4231,8 @@ func (s *Server) jsConsumerInfoRequest(sub *subscription, c *client, _ *Account,
|
||||
// We have been assigned but have not created a node yet. If we are a member return
|
||||
// our config and defaults for state and no cluster info.
|
||||
if isMember {
|
||||
// Since we access consumerAssignment, need js lock.
|
||||
js.mu.RLock()
|
||||
resp.ConsumerInfo = &ConsumerInfo{
|
||||
Stream: ca.Stream,
|
||||
Name: ca.Name,
|
||||
@@ -4238,7 +4240,9 @@ func (s *Server) jsConsumerInfoRequest(sub *subscription, c *client, _ *Account,
|
||||
Config: ca.Config,
|
||||
TimeStamp: time.Now().UTC(),
|
||||
}
|
||||
s.sendAPIResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(resp))
|
||||
b := s.jsonResponse(resp)
|
||||
js.mu.RUnlock()
|
||||
s.sendAPIResponse(ci, acc, subject, reply, string(msg), b)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user