[Zope-dev] Product refresh causes database connections leaking

Clemens Robbenhaar robbenhaar@espresto.com
Wed, 7 May 2003 20:08:57 +0200


Oliver Bleutgen writes:
 > I'm developing a product (based on SimpleUserFolder), which adds a 
 > folder with some ZSQL methods to itself on instanciation.
 > The ZSQL methods use a database adapter (Z Psyco DA 1.1.3, symptoms 
 > occur also with older versions).
 > 
 > After some time things went awry, because the DA had lost its connection 
 > to the database and couldn't reconnect, because the max connections 
 > postgres would allow were used.
 > 
 > Now I think I found the cause, because everytime I refresh my product, 
 > and the ZSQL Methods are used, the number of connections to postgres 
 > grows by 4.
 > 
 > Anybody knows what exactly is to blame, zope's refresh procedure or the 
 > database adapter?
 > 

 Maybe it is Your code which is to blame, who knows ;-)

 It seems the SQL connections were not garbage collected correctly, or
if they were, the corresponding connections were not closed properly.

 It is a little hard to say what is going on without details how and
where the connections are created. Anyway I have heard rumours, that the
"refresh" feature is not considered the most stable thingy in Zope, but
more a developer convenience hack.
 If You restart Your development server every forth time You usually
would do a refresh, You save Yourself a longer debugging session.

just my 2 cents
clemens