public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
* [Bitcoin-development] DEBUG_LOCKORDER : early detection of potential deadlocks
@ 2011-08-17 14:53 Gavin Andresen
  0 siblings, 0 replies; only message in thread
From: Gavin Andresen @ 2011-08-17 14:53 UTC (permalink / raw)
  To: Bitcoin Dev

Commit 865ed8a adds a new compile-time #ifdef : DEBUG_LOCKORDER

Compile with -DDEBUG_LOCKORDER and every time a lock is acquired by a
CCriticalSection a check is made to record the order of locks and
complain if they are being acquired in an inconsistent order.  Here's
what you get in debug.log when potential deadlocks are detected:

POTENTIAL DEADLOCK DETECTED
Previous lock order was:
 pwallet->cs_mapWallet  db.cpp:686
 pwallet->cs_KeyStore  db.cpp:687
 cs_KeyStore  keystore.cpp:74
 cs_vMasterKey  keystore.cpp:75
 cs_KeyStore  keystore.cpp:31
Current lock order is:
 pwallet->cs_mapWallet  db.cpp:686
 pwallet->cs_KeyStore  db.cpp:687
 cs_KeyStore  keystore.cpp:74
 cs_vMasterKey  keystore.cpp:75

POTENTIAL DEADLOCK DETECTED
Previous lock order was:
 pnode->cs_vRecv  net.cpp:1525
 cs_main  main.cpp:2372
 cs_vSend  net.h:681
Current lock order is:
 pnode->cs_vSend  net.cpp:1531
 cs_main  main.cpp:2411

I'll be working on figuring out how to eliminate these, and will be
working on some RPC stress-tests that try to exercise all the code
paths to early-detect other potential problems.

-- 
--
Gavin Andresen



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-17 14:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-17 14:53 [Bitcoin-development] DEBUG_LOCKORDER : early detection of potential deadlocks Gavin Andresen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox