Bug #1722 SIGSEGV signal from mysql_free_result
Submitted: 31 Oct 2003 3:50 Modified: 29 Dec 2003 4:11
Reporter: Dragos Moinescu Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:3.23.51 OS:Linux (Slackware 8.1)
Assigned to: Jani Tolonen CPU Architecture:Any

[31 Oct 2003 3:50] Dragos Moinescu
Description:
My program receives SIGSEGV when calling `mysql_free_result()`, even if the function receives a valid mysql_result (from `mysql_store_result()`) as argument.
When running with `gdb` I receive the following message:

#0  __pthread_mutex_lock (mutex=0xc429f475) at mutex.c:99
#1  0x401bd4fb in __libc_free (mem=0x402689f0) at malloc.c:3151
#2  0x4028791a in my_no_flags_free () from /usr/lib/libmysqlclient.so.10
#3  0x40285850 in mysql_free_result () from /usr/lib/libmysqlclient.so.10

My program is a server that loads (using `dl_open()`) a plugin (`.so`) that connects to mysql and do some SQL stuff. The server is multi-threaded (pthread library).

How to repeat:
Please do a multi-threaded app that does the following:
1. the parent loads a plugin and passes the handler (`void*`) as argument to thread function.
2. in thread function call some functions from plugin that extract info from database and return to thread. After getting info, do mysql_free_result(result).
[23 Dec 2003 11:08] MySQL Verification Team
This forum is dedicated to the fully repeatable test cases.

We need your program source so that we can verify the bug.

You can send only the relevant part of your code, though.
[28 Dec 2003 1:37] [ name withheld ]
Hi,

I got the same problem, SIGSEGV on mysql_free_result. But it was because I was using my own my_malloc, and there is also a my_malloc defining by libmysqlclient. I got no problem now, by renoming my my_malloc to mon_malloc_amoi.

Hope this help.

PS:But first, I really think it was a bug in libmsql, by cutting my code to the minimum to get the bug, i found that i need the definition of my_malloc, even if it wasn't use by the programme! I did this when I was reporting a bug to mysql :)