Hello, this is a retry on issue submitted previously to Python bug tracker as #1653121.
Today I encountered a problem with system complaining on double free/corruption, but as I don't know C, I cann't say it's a problem with Python or with MySQLdb.
Attached is a stack trace that I saw in screen session termination window. I am unable to reproduce this error, I tried few times, but it does not happen.
The system is pretty standard FC4. Below is as some system information, let me know if I should provide you anything more.
MySQL is 5.0.27
MySQLdb is 1.2.1_p2
$ python
Python 2.4.3 (#1, Jun 13 2006, 16:41:18)
[GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2
$ uname -a
Linux localhost 2.6.17-1.2139_FC4smp #1 SMP Fri Jun 23 21:12:13 EDT 2006 i686 i686 i386 GNU/Linux
$ yum list installed glibc
Installed Packages
glibc.i686 2.3.6-3
stack trace
Logged In: YES
user_id=71372
Originator: NO
libmysqlclient.so.14 is from MySQL-4.1, not 5.0, which has libmysqlclient.so.15. You may have both libraries on your system. In any case, MySQLdb/_mysql.so seems to be compiled against MySQL-4.1 and not 5.0.
The backtrace doesn't tell me much more than you were calling _mysql_real_query() via connection.query(), probably via db.execute().
Logged In: YES
user_id=92222
Originator: YES
If I get this error again, I'll try to get the trace. Yesterday I recompiled MySQLdb again with MySQL client v5.0.27 and I didn't get this error yet.
Anyway, this seemed to be related to heavy use of threads, as I did not see this in non-threaded applications.
Logged In: YES
user_id=71372
Originator: NO
Ah, then you should be using libmysqlclient_r.so; that is the thread-safe client library.
I hit this with a Django + MySQL application on Fedora 14 64bit virtual machine running fastcgi. It appeared to happen when multiple POST requests were made to the server at the same time and when fcgi is run threaded. Changing the method to prefork eliminated the error.
python ./manage.py runfcgi ... method=threaded ...
/usr/lib/python2.7/site-packages/django/template/defaulttags.py:101: UserWarning: A {% csrf_token %} was used in a template, but the context did not provide the value. This is usually caused by not using RequestContext.
warnings.warn("A {% csrf_token %} was used in a template, but the context did not provide the value. This is usually caused by not using RequestContext.")
glibc detected python: double free or corruption (out): 0x00007f1c4007d5a0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x38c1c76d63]
/usr/lib64/mysql/libmysqlclient_r.so.16(vio_delete+0x19)[0x34c5456249]
/usr/lib64/mysql/libmysqlclient_r.so.16(end_server+0x32)[0x34c5451192]
/usr/lib64/mysql/libmysqlclient_r.so.16(cli_safe_read+0xf8)[0x34c5451348]
/usr/lib64/mysql/libmysqlclient_r.so.16(cli_read_rows+0x266)[0x34c5451696]
/usr/lib64/mysql/libmysqlclient_r.so.16(mysql_store_result+0x90)[0x34c5453d90]
/usr/lib64/python2.7/site-packages/_mysql.so(+0x4626)[0x7f1c4e1e5626]
/usr/lib64/python2.7/site-packages/_mysql.so(+0x6066)[0x7f1c4e1e7066]
/usr/lib64/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x560b)[0x38d0ce965b]
/usr/lib64/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x66cd)[0x38d0cea71d]
MySQL-python.x86_64 1.2.3-1.fc14
mysql.x86_64 5.1.58-1.fc14
python.x86_64 2.7-8.fc14.1
Django.noarch 1.3.1-2.fc14
python-flup.noarch 1.0.2-2.fc14
I realize python 2.7 isn't officially supported but this may be a longer term issue considering the age of this bug. If I should file a new bug or file another somewhere else, please let me now. If there is anything I can do please let me know.