[mod_python] Creating many mysqld processes

Sean Abrahams abrahams at gmail.com
Wed Jul 14 10:39:26 EDT 2004

On Sat, 10 Jul 2004 09:03:44 -0700, Paul Eden
<peden at americanphysicians.net> wrote:
> I created an intranet application with mysql and mod_python and am
> having trouble with extra mysqld processes on the server.
> They don't seem to be being destroyed/collected until I restart the
> mysql server.
> This is probably some error on my part in coding the application, but I
> am not sure where the problem is.
> Will someone please tell me at what point in the DB API specification
> the extra mysqld are destroyed if at all or how I can get rid of them
> after they are finished?  Is it just connection.close()?

Mod_python is a long living process. As long as Apache is running, so
is your mod_python application. Whenever you make a connection to a
database from your mod_python application, it will not be disconnected
until you call connection.close() or you stop Apache or MySQL.

What you will need to do is create a ConnectionPool which will store
connections to the database and hand them out when you need them.
There is a FAQ entry on the mod_python web site:

Although, the example only shows how to connect to one database, not
multiples. If you are connecting to multiple different databases, make
DB_CONN a dict that stores each database connection in its own key.


> mod_python-3.1.3-1
> MySQL-python-0.9.1-6
> python-2.2.3-5
> httpd-2.0.46-32.ent.3
> Red Hat Enterprise Linux ES release 3
> Thank You,
> Paul
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list