[Zope-Coders] Who killed the Zope HEAD?

Shane Hathaway shane@zope.com
Tue, 19 Mar 2002 14:52:20 -0500


This is a multi-part message in MIME format.
--------------060800050905010003040206
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Shane Hathaway wrote:
> Toby Dickenson wrote:
> 
>> On Tuesday 19 March 2002 3:28 pm, you wrote:
>>> please tell us what this change does and what side
>>> effects it might have.
>>>
>>
>> It tells bsddb that we might be accessing the database from more than 
>> one thread. Im sure this should be safe, and Ive just confirmed that 
>> it doesnt cause a problem here.
>>
>> Can anyone verify that the trunk is broken?
> 
> 
> There is a reasonable possibility I just need to update my bsddb 
> installation.  I'll compile the latest stable code and try it again soon.

Well, it turns out I already had all the latest stable code: Python 
2.1.2, BerkeleyDB 3.3.11 with both patches, and bsddb3 3.3.0.  The 
freeze still happens.

So I did some further investigation.  The freeze happens in 
bsddb3storage/Full.py, line 1103, which reads:

     self._metadata.delete(key)

This is called in the middle of _dopack().  I thought that maybe the 
_metadata table was being locked by a function calling this routine, and 
that the type of lock being used was not reentrant.  Sure enough, 
_dopack() gets a cursor for the _metadata table, which it uses before 
calling _zaprevision(), but it actually finishes with it first.  So I 
added a "del c" in the middle of _dopack(), and the tests passed again.

I don't like checking in to modules I really know nothing about ;-) so 
could someone please verify this one-liner?  The problem I see is that 
if Berkeley's locks are non-reentrant, there could be more deadlocks 
lurking.  OTOH, the tests seem quite thorough and your machine didn't 
trip over it.  (Which is strange, but it doesn't bother me much. ;-) )

Shane

--------------060800050905010003040206
Content-Type: text/plain;
 name="patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch"

Index: Full.py
===================================================================
RCS file: /cvs-repository/Packages/bsddb3Storage/bsddb3Storage/Full.py,v
retrieving revision 1.39
diff -u -r1.39 Full.py
--- Full.py	12 Feb 2002 22:33:09 -0000	1.39
+++ Full.py	19 Mar 2002 19:44:34 -0000
@@ -1181,6 +1181,7 @@
                 # object, then it's packable.
                 elif self._serials[oid] <> key[8:]:
                     packablerevs.setdefault(oid, []).append(key)
+        del c  # We don't need the metadata cursor anymore.
         # We now have all the packable revisions we're going to handle.  For
         # each object with revisions that we're going to pack away, acquire
         # the storage lock so we can do that without fear of trampling by

--------------060800050905010003040206--