Skip to content

Commit

Permalink
morph: Fix subscription deadlock (#2720)
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-khimov authored Jan 24, 2024
2 parents c9ddb54 + d8beaf7 commit 895559b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Changelog for NeoFS Node
- Incorrect address mapping of the Alphabet contracts in NNS produced by deployment procedure (#2713)
- IR compares and logs public keys difference, not hash of keys difference at SN verification check (#2711)
- Incorrect handling of notary request leading to inability to collect signatures in some cases (#2715)
- Deadlock in autodeploy routine (#2720)

### Changed
- Created files are not group writable (#2589)
Expand Down
8 changes: 4 additions & 4 deletions pkg/morph/client/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ func (c *Client) Notifications() (<-chan *state.ContainedNotificationEvent, <-ch
}

type subscriptions struct {
sync.RWMutex

// notification consumers (Client sends
// notifications to these channels)
notifyChan chan *state.ContainedNotificationEvent
Expand All @@ -220,6 +218,8 @@ type subscriptions struct {
curBlockChan chan *block.Block
curNotaryChan chan *result.NotaryRequestEvent

sync.RWMutex // for subscription fields only

// cached subscription information
subscribedEvents map[util.Uint160]struct{}
subscribedToAllNotaryEvents bool
Expand All @@ -237,11 +237,11 @@ func (c *Client) routeNotifications() {
routeloop:
for {
var connLost bool
c.subs.RLock()
c.switchLock.RLock()
notifCh := c.subs.curNotifyChan
blCh := c.subs.curBlockChan
notaryCh := c.subs.curNotaryChan
c.subs.RUnlock()
c.switchLock.RUnlock()
select {
case <-c.closeChan:
break routeloop
Expand Down

0 comments on commit 895559b

Please sign in to comment.