Persistence versus __del__

Bug #143338 reported by Tim Peters on 2005-03-03
2
Affects Status Importance Assigned to Milestone
ZODB
Wishlist
Unassigned

Bug Description

If a persistent object has a __del__ method, bad things can happen. The combination probably ought to be disallowed upon an attempt to create a persistent class with a __del__ method. More info in this thread:

<http://mail.zope.org/pipermail/zodb-dev/2005-February/008522.html>

Unfortunately, that spills in to March too.

Tim Peters (tim-one) wrote :

Changes: revised title, new comment

Repaired typo in Title.

Florent Guillaume (efge) wrote :

The March thread continues at
http://mail.zope.org/pipermail/zodb-dev/2005-March/008529.html

For the record I'll paste the traceback here:

  File "/opt/zope/lib/python/ZPublisher/Publish.py", line 92, in publish
    object=request.traverse(path, validated_hook=validated_hook)
  File "/opt/zope/lib/python/ZPublisher/BaseRequest.py", line 231, in traverse
    object=object.__bobo_traverse__(request)
  File "/opt/zope/lib/python/ZODB/ZApplication.py", line 48, in __bobo_traverse__
    conn=db.open(version)
  File "/opt/zope/lib/python/ZODB/DB.py", line 504, in open
    c._setDB(self)
  File "/opt/zope/lib/python/Products/ZODBMountPoint/Mount.py", line 180, in _setDB
    conn._setDB(conn._db)
  File "/opt/zope/lib/python/Products/ZODBMountPoint/Mount.py", line 176, in _setDB
    self._real_setDB(odb)
  File "/opt/zope/lib/python/ZODB/Connection.py", line 257, in _setDB
    self._flush_invalidations()
  File "/opt/zope/lib/python/ZODB/Connection.py", line 552, in _flush_invalidations
    self._cache.invalidate(self._invalidated)
  File "/appli/zeo/zeocli-192.168.106.6-8080/Products/DICOD/DICODMailingList.py", line 125, in __del__
  File "/opt/zope/lib/python/ZODB/Connection.py", line 599, in setstate
    invalid = self._is_invalidated(obj)
  File "/opt/zope/lib/python/ZODB/Connection.py", line 617, in _is_invalidated
    self._inv_lock.acquire()

The __del__ method at line 125 basically just does
  foo = self.foo

Tim Peters (tim-one) wrote :

Uploaded: deadlock.py

The attached deadlocks reliably (ZODB 3.2.6b1). Alas, while it uses a __del__ method to do so, it's on a non-persistent object: the potential problems are worse than just persistent classes with __del__.

Hanno Schlichting (hannosch) wrote :

This looks like it should affect both Persitence and persistent.

affects: zope2 → zodb
Jim Fulton (jim-zope) wrote :

I'm find with disallowing __del__, however, this will require a meta-class AFAIK.
I both love and hate meta classes. :) I want to save them for when I really need then,
but I rarely really need them.

This will need to wait for the persistence redo.

Changed in zodb:
importance: Medium → Wishlist
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments