Subject: Re: [Bitcoin-development] 0.4rc1 known bugs

From: Gavin Andresen <[email-masked]>
Date: Tue, 6 Sep 2011 13:59:29 -0400

Nice work, Detective Wuille!

Patch for the deadlock issue:

https://github.com/bitcoin/bitcoin/pull/500

I took a different approach to fix from the one Pieter suggested,
performing the database operation after the cs_mapaddresses deadlock
is released.  Please review to check my logic, it did survive my
start/stop/restart... stress test.

And I did review every place in the code that starts a database
transaction, to look for similar issues, and they are all OK.

RE: improving DEBUG_LOCKORDER:  requires some thought.  Deadlocks are
still possible with TRY_CRITICAL_SECTION, if some codepaths TRY and
some don't.

On Tue, Sep 6, 2011 at 7:55 AM, Pieter Wuille
<[email-masked]> wrote:
> My mistake: these are not actual potential deadlocks, as all locking
> of cs_vRecv/cs_vSend
> happens inside TRY_CRITICAL_SECTION blocks. Gavin, maybe you can add the rule to
> your debug code that ignores critical sections which are only locked
> through TRY_...?
>
>>> + sipa found what looks like a deadlock between the addr-handling and
>>> IRC-join-handling code.
>
> Regarding the actual deadlock between IRC seeding and AddAddress:
>
> Internally, DB also uses pthreads to implement the txn_begin()/commit() scheme,
> though I'm not sure with which granularity. These need to be taken into account
> when searching for deadlocks, but are obviously not detected by
> DEBUG_LOCKORDER.

-- 
--
Gavin Andresen