[mod_python] MySQL invalid pointer error

Richard Lewis richardlewis at fastmail.co.uk
Thu Nov 2 05:06:15 EST 2006

Hi there,

Apache: 2.2.3
mod_python: 3.2.10
MySQL: 5.0.26
MySQLdb: 1.2.1

I'm doing some stuff with MySQL and mod_python and have been noticing some 
concerning entries in my Apache error log:

*** glibc detected *** free(): invalid pointer: 0x0834241d ***
[Wed Nov 01 18:43:20 2006] [notice] child pid 7637 exit signal Aborted (6)

I /think/ they are coming from MySQL. Can anyone confirm this?

I've tried a couple of different strategies for connecting to the database. 
First I tried using a global connection object in the handler module. This 
seemed to work OK except for the error messages shown above. Next I tried 
making every function that needed the database create and close its own 
connection. This didn't give any errors but was /really/ slow. Now I have a 
connection object created at the start of the handler function (effectively), 
passed around between all the functions and objects of my application and 
then closed when the handler finishes. This seems to work at a good speed but 
still gives me these error messages.

One thing I often find is that the connection cannot be closed properly at the 
end of the handler function; it seems as though its already been closed by 
the time execution gets there.

Would using a database connection pooling tool like sqlrelay be of any help?

Richard Lewis
Sonic Arts Research Archive
JID: ironchicken at jabber.earth.li

More information about the Mod_python mailing list