Interface Provides Declaration wearkrefs broken when added to ZODB

Bug #98477 reported by Ross Patterson
4
Affects Status Importance Assigned to Milestone
Zope 3
Won't Fix
Medium
Unassigned
3.2
Won't Fix
Undecided
Unassigned
3.3
Won't Fix
Undecided
Unassigned
3.4
Won't Fix
Medium
Unassigned
zope.interface
Won't Fix
Medium
Unassigned

Bug Description

An instance of a class that subclasses persistent.Persistent is
declared that it zope.interface.directlyProvides a
zope.interface.InterfaceClass instance and then the persistent object
is added to the ZODB and committed. Then if the persistent instance is
deleted from the ZODB, the transaction is committed, and the ZODB is
packed, and gc.collect is run, the ProvidesClass instance in the
InterfaceClass.dependents WeakKeyDict still remains. It does not,
however, remain if the persistent interface was never added to the
ZODB.

I'm not sure if this represents a potential memory leak or not. What
confuses me is that it all behaves properly unless the persistent
instance is added to the ZODB. Furthermore, the
PersistentInterfaceClass using a PersistentWeakKeyDict for it's
dependents attribute works properly when added to the ZODB. I noted
the comment about weak referrences being added to the ZODB
optomistically in ZODB.serialize. Could that be it?

I'd be happy to investigate this further if given a little direction.

Attached is a patch to the zope.app.interface tests to expose this
bug.

Revision history for this message
Ross Patterson (rossp) wrote :
Revision history for this message
Christian Theune (ctheune) wrote :

I think you're right. Thanks for the test case. I can't give you direct hints, but the report is valid.

Changed in zope3:
status: New → Confirmed
Revision history for this message
Ross Patterson (rossp) wrote :

Does anyone else have any hints for me? I'd be happy to pick this back up.

Tres Seaver (tseaver)
Changed in zope.interface:
status: New → Confirmed
importance: Undecided → Medium
Changed in zope3:
status: Confirmed → Won't Fix
Tres Seaver (tseaver)
tags: added: bugday20100424
Revision history for this message
Justin Alan Ryan (justizin) wrote :

This patch no longer applies, or can be hand-merged, because the tests in zope.interface have changed too much.

The nearby tests in the patch, e.g. test_persistentWeakref, don't seem to exist at all anymore.

I can probably write a new one, just making a note.

Revision history for this message
Tres Seaver (tseaver) wrote :

No persistence-related code remains anywhere in zope.interface.

Changed in zope.interface:
status: Confirmed → Won't Fix
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.