Ian Bicking <ianb <at> colorstudy.com> writes:
>
> Chas Emerick wrote:
>
> [snip]
>
> > Specifically, we've been successful with this line (<3 connections ever
> > show as being open in pg_stat_activity, even under load):
> >
> > postgres =
> > pgconnection.PostgresConnection.connectionFromURI('postgres://web <at>
localhost/web')
> >
> > but either of these lines cause major leakage:
> >
> > # postgres = PackageHub('postgresql')
> > # postgres = AutoConnectHub('postgres://web <at> localhost/web')
>
> I'm not familiar with AutoConnectHub? But the key part is how you
> connect and disconnect your connection from the hub. I usually do it like:
>
> try:
> hub.threadConnection = connectionFromURI(...)
> do stuff...
> finally:
> hub.threadConnection = None
AutoConnectHub is a pylons subclass of ConnectionHub. My understanding is that
it does roughly what you outlined above. I've also tried using a regular
ConnectionHub and then using connectionFromURI explicitly (again, as you
indicate), but the results are the same -- connections are never released, and
continue to be created until the database server puts a stop to it.
> Additionally in the trunk there's
> http://svn.colorstudy.com/SQLObject/trunk/sqlobject/wsgi_middleware.py
> which should handle this logic in a WSGI context.
Thanks, I'll take a look at that. This is all under pylons though, so I suspect
its PackageHub and AutoConnectHub classes do something similar.
- Chas
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss