Exceptions while unpickling broken objects

Bug #997574 reported by Patrick Gerken
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ZODB
New
Undecided
Unassigned

Bug Description

This is a weird one, unfortunately my debugging skillz failed me here.

We had a site with LinguaPlone which registers persistent utilities.
Upon removing them, we get errors when accessing the site.

This is the traceback:

2012-05-10 12:41:17 ERROR ZODB.Connection Couldn't load state for 0x156b
Traceback (most recent call last):
  File "/home/do3cc/.eggs/ZODB3-3.10.5-py2.6-linux-x86_64.egg/ZODB/Connection.py", line 860, in setstate
    self._setstate(obj)
  File "/home/do3cc/.eggs/ZODB3-3.10.5-py2.6-linux-x86_64.egg/ZODB/Connection.py", line 914, in _setstate
    self._reader.setGhostState(obj, p)
  File "/home/do3cc/.eggs/ZODB3-3.10.5-py2.6-linux-x86_64.egg/ZODB/serialize.py", line 614, in setGhostState
    state = self.getState(pickle)
  File "/home/do3cc/.eggs/ZODB3-3.10.5-py2.6-linux-x86_64.egg/ZODB/serialize.py", line 607, in getState
    return unpickler.load()
  File "/home/do3cc/v/dynajet/lib/python2.6/copy_reg.py", line 49, in _reconstructor
    obj = object.__new__(cls)
TypeError: (TypeError('object.__new__(SyncedLanguages) is not safe, use persistent.Persistent.__new__()',), <function _reconstructor at 0x7fe8f8afff50>, (<class 'Products.LinguaPlone.vocabulary.SyncedLanguages'>, <type 'object'>, None))

The SyncedLanguage class is, as expected a PersistentBroken object. Why _reconstructor tries to call object.__new__ is beyond me.
I've tried to find out who called _reconstructor, but didn't find a reasonable candidate. There is _reduce_ex, also in copy_reg like _reconstructor, but a PDB in that place never appears.
_reconstructor gets the class object, a base class and some other vars. In my pdb, I noticed that the base class was a plain object, but the method _reduce_ex would have given cls itself as a base class. So I tried to monkey patch _reconstructor to catch the TypeError and then calculate the base class like _reduce_ex does, and then just run the same code with the diffrent base class again.
This helps in our site.

Even though I patched python core libs to fix the issue, I write the issue in zodb, because it could still be zodb code thats calling the _reconstructor code here.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.