Commit ce36f2c
committed
Acquire
Previously, we would hold the `per_peer_state` `read` lock during the
serialization of channel objects. While this might have reduced lock
congestion minimally, we also calculated the number of serializable
peers in this phase, only to use it later after dropping and reacquiring
the `per_peer_state` `write` lock.
This could potentially result in inconsistiencies if the
`serializable_peer_count` would change after we dropped the `read` lock
but before we acquired the `write` lock.
To mitigate the issue we just acquire the `write` lock ealier and hold
it for the remainder of `ChannelManager::write`.per_peer_state write lock earlier in ChannelManager::write
1 parent ac9a2c8 commit ce36f2c
1 file changed
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11035 | 11035 | | |
11036 | 11036 | | |
11037 | 11037 | | |
| 11038 | + | |
| 11039 | + | |
11038 | 11040 | | |
11039 | 11041 | | |
11040 | | - | |
11041 | 11042 | | |
11042 | 11043 | | |
11043 | 11044 | | |
| |||
11084 | 11085 | | |
11085 | 11086 | | |
11086 | 11087 | | |
11087 | | - | |
11088 | | - | |
11089 | 11088 | | |
11090 | 11089 | | |
11091 | 11090 | | |
| |||
0 commit comments