[Zodb-checkins] CVS: ZODB3/Persistence - cPickleCache.c:1.85.8.15

Tim Peters tim.one at comcast.net
Wed Jul 9 18:22:58 EDT 2003


Update of /cvs-repository/ZODB3/Persistence
In directory cvs.zope.org:/tmp/cvs-serv27557/Persistence

Modified Files:
      Tag: zodb33-devel-branch
	cPickleCache.c 
Log Message:
cc_traverse():  If the ring lock is set, "junk" may be in the ring, so
it's not safe to traverse the ring passing its objects back to the visit()
callback.  Instead just return -- the cache will act like a source of
external references then, and at worst maybe we'll delay cleaning up a
dead cycle involving the cache.


=== ZODB3/Persistence/cPickleCache.c 1.85.8.14 => 1.85.8.15 ===
--- ZODB3/Persistence/cPickleCache.c:1.85.8.14	Wed Jul  9 17:16:55 2003
+++ ZODB3/Persistence/cPickleCache.c	Wed Jul  9 17:22:51 2003
@@ -655,6 +655,17 @@
     int err;
     CPersistentRing *here;
 
+    /* If we're in the midst of cleaning up old objects, the ring contains
+     * assorted junk we must not pass on to the visit() callback.  This
+     * should be rare (our cleanup code would need to have called back
+     * into Python, which in turn triggered Python's gc).  When it happens,
+     * simply don't chase any pointers.  The cache will appear to be a
+     * source of external references then, and at worst we miss cleaning
+     * up a dead cycle until the next time Python's gc runs.
+     */
+    if (self->ring_lock)
+    	return 0;
+
 #define VISIT(SLOT) \
     if (SLOT) { \
 	err = visit((PyObject *)(SLOT), arg); \




More information about the Zodb-checkins mailing list