[mod_python] Lifespan of objects

Nic Ferrier nferrier at tapsellferrier.co.uk
Thu Aug 19 22:46:21 EDT 2004


Svenne Krap <svenne at krap.dk> writes:

> I don't realize how I am using a single connection in parallel.
> 
> While running apache, it forks new processes if there are simultanious 
> connections. Each of these should open exactly one connection and
> use that.

Sorry, I missed what mpm you were using. 


> I thought, that my example was a simple connection pool (I never need 
> more than one cursor open per process anyhow), if I am in error, please 
> provide pointers to a good connection pool (I haven't been able to 
> locate any through google. Just a mailing-list suggestion that resembles 
> my solution).
> 
> It seems however, when I modify the .py-file the amount of connections 
> grow. Is my program "losing" connections when the module is reloaded
> ?

If you modify the .py I'm sure you'll lose them. The old instances
will go out of scope and not be closed.

When I started playing with DB API stuff I thought that destruction
would close the connection, but it didn't seem to. I had to
specifically close them.


Nic


More information about the Mod_python mailing list