Skip to content

Commit

Permalink
Merge pull request #114 from nats-io/fix_data_race
Browse files Browse the repository at this point in the history
Fix data race on client close
  • Loading branch information
kozlovic authored Jun 23, 2016
2 parents 4d3c783 + 6cd1c02 commit a92d865
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,12 @@ func (ss *subStore) Remove(sub *subState, force bool) {

// Delete ourselves from the list
if qs != nil {
// For queue state, we need to lock specifically,
// because qs.subs can be modified by findBestQueueSub,
// for which we don't have substore lock held.
qs.Lock()
qs.subs, _ = sub.deleteFromList(qs.subs)
qs.Unlock()
} else {
ss.psubs, _ = sub.deleteFromList(ss.psubs)
}
Expand Down

0 comments on commit a92d865

Please sign in to comment.