bitcoind stops responding



Summary:

The author suspects that `LOCK2(cs_main, pwalletMain->cs_wallet)` is causing lock contention with other threads. They modified `bitcoinrpc.cpp` to measure how long it takes to acquire the locks and found that it took over 6 seconds in some cases. The modified code includes a function to calculate time differences between two time values and a function to print execution times. They inserted a block of code to execute the method if it is not thread-safe, which acquires the locks, measures the time it takes to do so, executes the method, measures the call time, and prints all three times. They provide a log of the lock time, call time, and total time for each execution of the block of code. One of the executions took almost 6 seconds to acquire the locks.


Updated on: 2023-06-07T17:11:24.931283+00:00