glibc detected double free or corruption

Aryeh Leib Taurog vim at
Mon Feb 8 21:54:15 CET 2010

I'm encountering the following error on my fastcgi web server and
greatly appreciate ANY pointers for debugging/fixing this problem.

*** glibc detected *** /usr/bin/python2.5: double free or corruption
(fasttop): 0x08b47d60 ***

If I don't set MALLOC_CHECK_ then the server just hangs and the above
message appears in the fastcgi error log.  With MALLOC_CHECK_=0 I get
error message in the browser instead.

I'm using the following components (on a shared hosting account):

Debian lenny 64 bit
Python 2.5.2
lighttpd 1.4.19
Django 1.1.1
latest flup (today's hg tip, flup-server-ae5fe54fba18)
postgresql 8.3.9
psycopg2 2.0.13

What's interesting about the problem is it seems to happen only when
fcgi processes are spawned and only when a db query is made.  That is,
frequency of the problem corresponds exactly with the maxrequests
on my fcgi process.  If I set maxrequests to 1 then I get this error
each request that hits the database.  If I set it to 3 then I get the
with every third request, if that request hits the database.

If I put Django into DEBUG and set MALLOC_CHECK_=0 then I get the
error with traceback:

Exception Type:  OperationalError
Exception Value: server closed the connection unexpectedly
                 This probably means the server terminated abnormally
                 before or while processing the request.

Exception Location:	/home/altaurog/django/db/backends/ in
execute, line 19

Regardless of which url/view I request, the exception always is raised
on a
sql execute statement.

Aryeh Leib Taurog

More information about the Python-list mailing list