[Zope] Trying to trap ConflictError

dieter at handshake.de dieter at handshake.de
Wed Jul 5 15:25:49 EDT 2006


Jonathan wrote at 2006-7-5 14:40 -0400:
> ...
>The id for the image object is generated by the following code:
>
>def MakeId():
>   time.sleep(.01)
>   ts = string.replace(str(time.time()),'.', '')   # remove floating point 
>'.' char
>   return ts[-10:]
>
>So there should not be any collision of ids.

You should verify this. I doubt that you are right, as both the
scheduling as well as the clock granularity are discrete (and rather
coarse).

I suggest you use either the mechanism of

  *  the "BrowserIdManager"::it combines a time with a random number

  *  the "ZCatalog": it chooses per thread a random number and
     then assignes sequentially, until a conflict happens.
     Then it restarts (choosing a random number...)

>I am still investing, and have found errors like:
>
>2006-07-04T14:48:12 ERROR ZODB.Connection Couldn't load state for 0x1c
>Traceback (most recent call last):
>  File "/usr/local/Zope-2.9.2/lib/python/ZODB/Connection.py", line 732, in 
>setstate
>    self._setstate(obj)
>  File "/usr/local/Zope-2.9.2/lib/python/ZODB/Connection.py", line 768, in 
>_setstate
>    p, serial = self._storage.load(obj._p_oid, self._version)
>  File "/usr/local/Zope-2.9.2/lib/python/tempstorage/TemporaryStorage.py", 
>line 104, in load
>    s=self._index[oid]
>KeyError: '\x00\x00\x00\x00\x00\x00\x00\x1c'
>
>in the event.log.

Apparently, you have more than a single type of error...


Are you the person that used "try: ... except: ..."?

   The non-deterministic inconsistencies caused by such constructs
   can look like what you decribe above...



-- 
Dieter


More information about the Zope mailing list