Commit cd0bfdb
committed
Expect callers to hold read locks before
Our existing lockorder tests assume that a read lock on a thread
that is already holding the same read lock is totally fine. This
isn't at all true. The `std` `RwLock` behavior is
platform-dependent - on most platforms readers can starve writers
as readers will never block for a pending writer. However, on
platforms where this is not the case, one thread trying to take a
write lock may deadlock with another thread that both already has,
and is attempting to take again, a read lock.
Worse, our in-tree `FairRwLock` exhibits this behavior explicitly
on all platforms to avoid the starvation issue.
Sadly, a user ended up hitting this deadlock in production in the
form of a call to `get_and_clear_pending_msg_events` which holds
the `ChannelManager::total_consistency_lock` before calling
`process_pending_monitor_events` and eventually
`channel_monitor_updated`, which tries to take the same read lock
again.
Luckily, the fix is trivial, simply remove the redundand read lock
in `channel_monitor_updated`.
Fixes #2000channel_monitor_updated
1 parent c611d5f commit cd0bfdb
1 file changed
+10
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4101 | 4101 | | |
4102 | 4102 | | |
4103 | 4103 | | |
4104 | | - | |
| 4104 | + | |
4105 | 4105 | | |
4106 | 4106 | | |
4107 | 4107 | | |
| |||
5068 | 5068 | | |
5069 | 5069 | | |
5070 | 5070 | | |
| 5071 | + | |
| 5072 | + | |
5071 | 5073 | | |
5072 | 5074 | | |
5073 | 5075 | | |
| |||
5145 | 5147 | | |
5146 | 5148 | | |
5147 | 5149 | | |
5148 | | - | |
| 5150 | + | |
| 5151 | + | |
| 5152 | + | |
| 5153 | + | |
| 5154 | + | |
| 5155 | + | |
| 5156 | + | |
5149 | 5157 | | |
5150 | 5158 | | |
5151 | 5159 | | |
| |||
0 commit comments