[Zope-DB] ZPsycopgDA Connections and Refreshed Zope Products

Federico Sevilla III jijo@free.net.ph
Sat, 22 Mar 2003 10:58:04 +0800

Hi Federico,
(cc Zope-DB list)

I have been working on a Zope product that inherits from Folder and has
an instance of ZPsycopgDA named 'dba'. The product has SQL methods for
various database work through 'dba', as well as an instance of the
eXtensible User Folder (XUF) that also uses 'dba' for looking up user
information. My Zope product has refreshing enabled through the presence
of a refresh.txt in its directory.

I have been noticing through the course of my development that I have
been accumulating connections to the database an instance of my Zope
product is using, recently even hitting ~70 connections. I could not
explain this, but through some searching in the archives read a
message[1] to you and the Zope-DB list by Andrew Veitch, describing a
problem that I have found to be exactly like mine.

[1] http://marc.free.net.ph/message/BA5D8B8F.86BA%andrew@logicalprogression.net.html

To verify, I restarted Zope, effectively closing all connections to
PostgreSQL. Then I accessed the instance of my product, initating a
connection. I did a number of other stuff, and still there was exactly
one connection. Then I updated the timestamp of a file in my product's
source directory, recompiled the .pyc and .pyo files, and refreshed my
product. The next access to an instance of my product created a new
connection to the PostgreSQL database.

Because this is my only Zope product using PostgreSQL (I have other
stuff using PostgreSQL and ZPsycopgDA, but they are not Zope products,
just "sites" created using the ZMI), I do not know how things will
behave if the site is accessed regularly but is not refreshed, as the
case will be when this thing is deployed.

I am using Debian GNU/Linux, with the following package versions:

 - zope              2.6.1-0.3
 - python2.1-psycopg 1.1.2-1
 - zope-psycopgda    1.1.2-1
 - zope-exuserfolder 0.10.10-3

Except for the zope package, these seem to be the latest versions in

Is this normal behavior of psycopg? Is this really just because of
product refreshing? I am worried about how this will impact performance
of the server when deployed. I especially wonder if there's some sort of
limit to this, or if it will just keep accumulating connections
everytime I refresh.

Thank you very much for your time.

 --> Jijo

Federico Sevilla III  : http://jijo.free.net.ph      : When we speak of free
Network Administrator : The Leather Collection, Inc. : software we refer to
GnuPG Key ID          : 0x93B746BE                   : freedom, not price.