Exceptions while unpickling broken objects
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/
self.
File "/home/
self.
File "/home/
state = self.getState(
File "/home/
return unpickler.load()
File "/home/
obj = object.__new__(cls)
TypeError: (TypeError(
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.