[Zope-dev] ZODB Competing read/writes: How to find out which attribute?

Marius Gedminas marius at gedmin.as
Sun Oct 11 15:27:58 EDT 2009


On Sat, Oct 10, 2009 at 10:56:09AM +0200, Hermann Himmelbauer wrote:
> Am Freitag 09 Oktober 2009 19:12:09 schrieb Shane Hathaway:
> > Hermann Himmelbauer wrote:
> > > Hi,
> > > I once in the while get the following warning in my Zope 3 log, which I'd
> > > like to resolve:
> > >
> > > 2009-10-07T14:35:41 WARNING ZopePublication Competing writes/reads
> > > at
> > > /BSPSite/act/++vh++http:zis.act.at:80/bankneu/++/c/acc/booklist/index.htm
> > >l: database conflict error (oid 0x7a5d, class BTrees.OOBTree.OOBTree,
> > > serial this txn started with 0x0381388ca6804966 2009-10-07
> > > 12:28:39.023700, serial currently committed 0x03813893b087d0cc 2009-10-07
> > > 12:35:41.374343)
> >
> > That URL looks like it should only be reading the database, but the fact
> > that you get a conflict error suggests that the code behind that URL is
> > writing to the database.  If I were you, I would first ensure that read
> > operations never write to the database.
> 
> That's exactly the problem - it's a read operation and there should not be any 
> write operation involved. However, it's hard to find out where the write 
> operation in my code occurs, I can't find it in the view, maybe there's 
> something in the authentication code, but I'd have to dig deep through my 
> source. So It would be extremely helpful to know a faster way to find out 
> what code triggered this warning.

Sometimes looking at the object in question can provide some hints.  You
have the OID, start up zodbbrowser (http://pypi.python.org/pypi/zodbbrowser),
go to @@zodbbrowser?oid=0x7a5d and see if the data sheds some link.
Some things, e.g. annotations, stand out pretty clearly (and the default
adapter for IAttributeAnnotatable is one of the things that has
write-on-read semantics.)

Sadly, the ZODB doesn't track backreferences, so there only way to find
out for sure what points to your object is to do a full graph traversal.

Cheers!
Marius Gedminas
-- 
http://pov.lt/ -- Zope 3 consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20091011/1ae096da/attachment.bin 


More information about the Zope-Dev mailing list