[Zope] ZODB conflict error AFTER adding an 'Access Rules'

Jean Baltus jean.baltus at africamuseum.be
Thu Sep 25 10:22:17 EDT 2003


Thank you for all the explanation.
I don't have time to put on my swimsuit and dive into the ZODB today but
I will...

In the meantime, here is the exact copy of my access rule (in case you
notice something weird):

session = context.REQUEST.SESSION
path_info = context.REQUEST['PATH_INFO']

if not session.has_key('skin'):
  session.set('skin', 'bidon')

if path_info.find("/muse") >=0:
  session.set('skin', 'muse')
elif path_info.find("/res") >=0:
  session.set('skin', 'res')

if session['skin']== 'res':
  context.changeSkin('res')

The script updates the 'skin' attribute of 'session' each time it
traverses the 'muse' or 'res' directory of our website. Then the
changeSkin method is called whenever we are in the 'res' part of the
website.

If you ever see something wrong with it, please tell me,

THANKS !!!

-- Jean

-----Original Message-----
From: Dieter Maurer [mailto:dieter at handshake.de] 
Sent: jeudi 25 septembre 2003 2:17
To: Jean Baltus
Cc: zope at zope.org
Subject: RE: [Zope] ZODB conflict error AFTER adding an 'Access Rules'

Jean Baltus wrote at 2003-9-24 12:07 +0200:
 > Thank you for your explanation Dieter. Do you have any clue why I'm
 > having write conflicts when I add a call to the "change_skin" method
in
 > the "Access Rule" of our Plone site !!! ??? Even when we just browse
the
 > website, no update being made...

Often, write conflicts are caused by using a session.
Reading a session causes a write (to update the timeout mechanism).

 > Is it possibly that it is a bug in CMF? In Zope? In the ZODB?

It is of course possible.
But I do not yet think it is likely, because I see few complaint
about conflict errors when using Zope/CMF.
E.g. we use it extensively and do not see this problem (and we use
AccessRules, too).

You can find out what the object with an oid is:

  Read about how to inspect ZODB objects in an interactive
  interpreter (you may need to add "PYTHONPATH" and stop Zope
  (or use ZEO)).

  In the interactive interpreter do:
  
     from Zope import app
     from ZODB.utils import p64

     R= app() # the root object
     c= R._p_jar # the main ZODB connection
     o= c[p64(oid_as_hex)] # the object with oid "oid_as_hex"
     print o

  In your case: "o= c[p64(0x11)]"

This assumes, the conflict occured within the main ZODB.

Sessions use there own ZODB (and therefore a ZODB connection
different from that of the root) and store their session objects in RAM.
Therefore, it is not possible to inspect the session objects
in a separate process. You would need to use the Zope "monitor"
to inspect a running Zope itself. There is a HowTo (very old;
the monitor is nowadays no longer enabled by default) on Zope.org.

Inside the "monitor" client, you can use Python to inspect your
running Python as shown above. Inspecting session object with
oid "0x11" would look like:

     from Zope import app
     from ZODB.utils import p64

     R= app() # the root object
     tf= R.temp_folder # the temporary folder
     c= tf._p_jar # the ZODB connection used by sessions
     o= c[p64(oid_as_hex)] # the object with oid "oid_as_hex"
     print o

 > ...
 >  > js/share.js: database conflict error (oid 0000000000000011, serial
 > was
 >  > 034fb0850


Dieter




More information about the Zope mailing list