[Checkins] SVN: relstorage/trunk/ If RelStorage tries to unpickle a corrupt object state during packing,
Shane Hathaway
shane at hathawaymix.org
Fri Sep 4 15:11:27 EDT 2009
Log message for revision 103554:
If RelStorage tries to unpickle a corrupt object state during packing,
it will now report the oid and tid in the log.
Changed:
U relstorage/trunk/CHANGES.txt
U relstorage/trunk/relstorage/adapters/common.py
U relstorage/trunk/relstorage/tests/reltestbase.py
-=-
Modified: relstorage/trunk/CHANGES.txt
===================================================================
--- relstorage/trunk/CHANGES.txt 2009-09-04 18:55:58 UTC (rev 103553)
+++ relstorage/trunk/CHANGES.txt 2009-09-04 19:11:27 UTC (rev 103554)
@@ -12,13 +12,15 @@
Next Bug Fix Release
--------------------
-- In Oracle, don't trip over transaction descriptions longer than 2000
- bytes.
+- In Oracle, trim transaction descriptions longer than 2000 bytes.
- When opening the database for the first time, don't issue a warning
about the inevitable POSKeyError on the root OID.
+- If RelStorage tries to unpickle a corrupt object state during packing,
+ it will now report the oid and tid in the log.
+
Version 1.2.0b2 (2009-05-05)
----------------------------
Modified: relstorage/trunk/relstorage/adapters/common.py
===================================================================
--- relstorage/trunk/relstorage/adapters/common.py 2009-09-04 18:55:58 UTC (rev 103553)
+++ relstorage/trunk/relstorage/adapters/common.py 2009-09-04 19:11:27 UTC (rev 103554)
@@ -691,7 +691,13 @@
state = state.read()
if state:
from_count += 1
- to_oids = get_references(str(state))
+ try:
+ to_oids = get_references(str(state))
+ except:
+ log.error("pre_pack: can't unpickle "
+ "object %d in transaction %d; state length = %d" % (
+ from_oid, tid, len(state)))
+ raise
for to_oid in to_oids:
add_rows.append((from_oid, tid, to_oid))
Modified: relstorage/trunk/relstorage/tests/reltestbase.py
===================================================================
--- relstorage/trunk/relstorage/tests/reltestbase.py 2009-09-04 18:55:58 UTC (rev 103553)
+++ relstorage/trunk/relstorage/tests/reltestbase.py 2009-09-04 19:11:27 UTC (rev 103554)
@@ -596,8 +596,16 @@
conn.close()
finally:
db.close()
-
+ def checkPackBrokenPickle(self):
+ # Verify the pack stops with the right exception if it encounters
+ # a broken pickle.
+ from cPickle import UnpicklingError
+ self._dostoreNP(self._storage.new_oid(), data='brokenpickle')
+ self.assertRaises(UnpicklingError, self._storage.pack,
+ time.time() + 10000, referencesf)
+
+
class DoubleCommitter(Persistent):
"""A crazy persistent class that changes self in __getstate__"""
def __getstate__(self):
More information about the checkins
mailing list