You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
4a269b2 bug: fix ProxyClient<Thread> deadlock if disconnected as IPC call is returning (Ryan Ofsky)
85df964 Use try_emplace in SetThread instead of threads.find (Sjors Provoost)
ca9b380 Use std::optional in ConnThreads to allow shortening locks (Sjors Provoost)
9b07991 doc: describe ThreadContext struct and synchronization requirements (Ryan Ofsky)
d60db60 proxy-io.h: add Waiter::m_mutex thread safety annotations (Ryan Ofsky)
4e365b0 ci: Use -Wthread-safety not -Wthread-safety-analysis (Ryan Ofsky)
Pull request description:
This bug is currently causing mptest "disconnecting and blocking" test to occasionally hang as reported by maflcko in bitcoin/bitcoin#33244.
The bug was actually first reported by Sjors in Sjors/bitcoin#90 (comment) and there are more details about it in #189.
The bug is caused by the "disconnecting and blocking" test triggering a disconnect right before a server IPC call returns. This results in a race between the IPC server thread and the `onDisconnect` handler in the event loop thread both trying to destroy the server's `request_threads` `ProxyClient<Thread>` object when the IPC call is done.
There was a lack of synchronization in this case, fixed here by adding `loop->sync()` various places. There were also lock order issues where `Waiter::m_mutex` could be incorrectly locked before `EventLoop::m_mutex` resulting in a deadlock.
ACKs for top commit:
Sjors:
ACK 4a269b2
Eunovo:
ACK 4a269b2
Tree-SHA512: 1894c33f9847ef755816e232cfc18843435e25ad5b400cd5a04eead732a738accc1da401fd13b5b11ade04fb3145060640760f53b431132cae022bd7d004e73b
0 commit comments