Likely Deadlock cs_setpwalletRegistered #2965

issue pstratem openend this issue on September 1, 2013
  1. pstratem commented at 9:33 am on September 1, 2013: contributor

    2013-09-01 09:22:23 POTENTIAL DEADLOCK DETECTED 2013-09-01 09:22:23 Previous lock order was: 2013-09-01 09:22:23 (1) cs_wallet wallet.cpp:774 2013-09-01 09:22:23 mempool.cs main.cpp:1114 2013-09-01 09:22:23 (2) cs_setpwalletRegistered main.cpp:129 2013-09-01 09:22:23 Current lock order is: 2013-09-01 09:22:23 pnode->cs_vRecvMsg net.cpp:1518 2013-09-01 09:22:23 cs_main main.cpp:4062 2013-09-01 09:22:23 (2) cs_setpwalletRegistered main.cpp:161 2013-09-01 09:22:23 (1) cs_wallet wallet.h:310 2013-09-01 09:22:23 LOCKCONTENTION: cs_setpwalletRegistered 2013-09-01 09:22:23 Locker: main.cpp:129

    This is likely caused by this commit https://github.com/bitcoin/bitcoin/commit/e5cefb9b

  2. sipa commented at 9:42 am on September 1, 2013: member
    This should at least be investigated before 0.9.0.
  3. Diapolo commented at 10:21 am on September 19, 2013: none
    @CodeShark Can you take a look please.
  4. Diapolo commented at 8:53 am on October 4, 2013: none
    A possible deadlock is a thing we should fix ASAP, can any core dev take a look?
  5. CodeShark commented at 8:40 pm on October 9, 2013: contributor
    I had actually replaced these locks with shared locks that shouldn’t have this issue - but apparently they caused pulltester to choke so they were removed. The only place where locking is necessary is when modifying the setpwalletRegistered structure itself (ie inserting or deleting).
  6. CodeShark commented at 9:00 pm on October 9, 2013: contributor
    Did anyone ever figure out why the boost::shared_lock solution didn’t work? I had tested it on my own system and didn’t have any problems with it.
  7. Diapolo commented at 7:12 am on October 10, 2013: none
    @CodeShark Could be because of old compiler/build environment and old Boost version used!?
  8. sipa commented at 8:10 pm on October 18, 2013: member
    I believe the solution here is to use boost::signals2 to register the wallet callbacks; signals2 is actually specifically designed to be thread-safe, while being concurrently modifiable.
  9. gavinandresen closed this on Oct 30, 2013

  10. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me