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
Merge #106: Bugfix: Clean up ThreadContext pointers when Connection is destroyed
8ba0d03 Bugfix: Clean up ThreadContext pointers when Connection is destroyed (Ryan Ofsky)
Pull request description:
Currently ThreadContext Connection* pointers are not removed up when a connection is destroyed. This is only a problem if a Connection instance is destroyed and new Connection is allocated at the same address, because the code assumes pointers uniquely identify connections. This causes a bug in a bitcoin IPC test which creates multiple connections in a loop, described in bitcoin/bitcoin#30509 (comment), and depending on how the heap allocator behaves, a new Connection could have the same address as a previously destroyed connection, and the code tries to use a thread reference associated with the previous connection when making a new call, and there is a segfault because the thread no longer exists.
Fix this problem by adding Connection cleanup callbacks to remove Connection* pointers from the ThreadContext struct if the connection is destroyed before the thread is.
Top commit has no ACKs.
Tree-SHA512: c715f15a2218e5c8073cf6e2852285b8ad295ed331187d7d4d454df28512621ef76067c7cb11ddf17065efdfa0f7096190ae9033466d252eea6ddae51ea44d64
0 commit comments