[ZODB-Dev] [ZEO.ClientStorage] leaks temporary ZODB connections

Dieter Maurer dieter at handshake.de
Mon Nov 10 08:23:21 EST 2003


ZODB 3.1, Python 2.1.3

Python 2.1.3 (#2, Mar 13 2003, 13:39:51) 
[GCC 3.2] on linux2
Type "copyright", "credits" or "license" for more information.
>>> from sys import getrefcount as gr
>>> from ZODB.DB import DB
>>> from ZEO.ClientStorage import ClientStorage
>>> from ZODB.Connection import Connection
>>> def step():
...   print gr(Connection)
...   db= DB(ClientStorage(('localhost',9888)))
...   c= db.open(temporary=1)
...   c.close() # this calls "c.__dict__.clear()"
...   db.close()
...   print gr(Connection)
...
>>> step()
6
7
>>> step()
7
8
>>> step()
8
9

The reason for this connection leakage lies in
"ZEO.ClientStorage.ClientStorage.close":

  It does not reset "_db" forming a cycle between the "DB"
  and "ClientStorage" instances.

-- 
Dieter



More information about the ZODB-Dev mailing list