Menu

#56 close() should be handled better inside Connection.py

open
nobody
None
5
2003-05-08
2003-05-08
No

If storage.close() or db.close() have been issued and a
commit() or connection.close() is called, evil errors
pop up.

See
http://mail.zope.org/pipermail/zodb-dev/2003-May/004983.html
for details.

Attached patch is a first cut at making this clearer.

Discussion

  • Christian Reis

    Christian Reis - 2003-05-08

    Bulletproof access to structures in Connection when *.close() has been called.

     
  • Christian Reis

    Christian Reis - 2003-05-08

    testClose.py: test bulletproofing (run against unpatched ZODB for extra fun)

     
  • Jeremy Hylton

    Jeremy Hylton - 2004-01-14

    Logged In: YES
    user_id=31392

    Is this still an issue?

     
  • Christian Reis

    Christian Reis - 2004-01-14

    Logged In: YES
    user_id=222305

    Let me check again, but I think it still is (with 3.2-CVS HEAD).

     
  • Christian Reis

    Christian Reis - 2004-01-14

    Logged In: YES
    user_id=222305

    Yeah, it still is:

    Traceback (most recent call last):
    File "testClose.py", line 51, in ?
    test()
    File "testClose.py", line 29, in test
    x.root()["foo"] = 100
    File
    "/mondo/local/lib/python2.3/site-packages/ZODB/Connection.py",
    line 542, in root
    return self['\0\0\0\0\0\0\0\0']
    File
    "/mondo/local/lib/python2.3/site-packages/ZODB/Connection.py",
    line 150, in __getitem__
    p, serial = self._storage.load(oid, self._version)
    File
    "/mondo/local/lib/python2.3/site-packages/ZODB/FileStorage.py",
    line 687, in load
    return self._load(oid, version, self._index, self._file)
    File
    "/mondo/local/lib/python2.3/site-packages/ZODB/FileStorage.py",
    line 658, in _load
    file.seek(pos)
    ValueError: I/O operation on closed file

    This happens when trying to write something to
    conn.root()['xxx']. If you look at the testcase (just
    comment out the ClosedError bits, which require the patch)
    you'll see what I mean.

    I can help out here, but I'd like guidance as to what to do.

     

Log in to post a comment.