[mod_python] invalid pointer, child process dies, broken connections

Jim Gallacher jpg at jgassociates.ca
Thu Nov 23 16:39:15 EST 2006

Richard Lewis wrote:
> Hi there,
> Debian unstable; apache: 2.2.3; modpython: 3.2.10; python: 2.4.4; lxml 1.1.1: 
> libxml: 2.6.16; libxslt: 1.1.8.

> I posted on 2nd Nov about some invalid pointer errors in my Apache error log. 
> At the time I thought they were coming from MySQL and received some 
> interesting replies regarding the incompatibility of the mysql client 
> libraries compiled into various apache modules.
> However, since then I've decided to cut MySQL out of my web application and, 
> instead of dynamically converting database records into XML, use 
> filesystem-cached XML files which are generated periodically from the 
> database by a separate

Were you using lxml, libxml and libxslt previously from within 
mod_python? If you can reduce things to the simplest possible test case 
I can check it on my Debian test setup.

> While there are a couple of other advantages to this approach, it hasn't 
> solved my initial problem! I still have numerous errors like this in my 
> Apache error log:
> [Mon Nov 20 10:51:58 2006] [notice] child pid 7087 exit signal Aborted (6)
> *** glibc detected *** free(): invalid pointer: 0x0835ab26 ***
> *** glibc detected *** free(): invalid pointer: 0x0835ab26 ***
> *** glibc detected *** free(): invalid pointer: 0x0835ab26 ***
> *** glibc detected *** free(): invalid pointer: 0x0835ab26 ***
> [Mon Nov 20 10:54:28 2006] [notice] child pid 7088 exit signal Aborted (6)
> [Mon Nov 20 10:54:28 2006] [notice] child pid 7089 exit signal Aborted (6)
> [Mon Nov 20 10:54:28 2006] [notice] child pid 7098 exit signal Aborted (6)
> It seems to handle several requests and then you get an error message from the 
> client (browser) saying that "the connection is broken". You can then retry 
> the request and it works after one or two attempts.
> I /think/ there is no direct correlation between the invalid pointer errors 
> messages and the dropped connections; the times of the messages seem to be 
> pretty evenly distributed and don't all result in a broken connection.
> Also, the memory addresses of the invalid pointers are often (but not always) 
> the same. While the child process ids are always different. What is the child 
> process? Is it python?

The child process refers to the Apache child process. The python 
interpreter is embedded in that process. The fact that the pids are 
different indicates that they are being killed off, which is generally a 
bad thing performance wise. Generally you want them to be long lived to 
avoid the overhead of forking a new process.

> I've checked to make sure that I'm always returning the content length and 
> Apache status code; I'm pretty sure I am! My application is using a frameset 
> where the frame document and its four frames are all generated using 
> mod_python. Is there anything special I should do to help mod_python with 
> this? (Like returning special Apache status codes?)

Nope. There is nothing special about framesets. As far as apache or 
mod_python are concerned it's just regular content. The only thing to be 
aware of is if you are accessing session data in each page of the 
frameset. You'll want to manually unlock the session as soon as possible 
for maximum performance. However this totally unrelated to your problem.


More information about the Mod_python mailing list