[unixODBC-support] Poolling Segfault

Paul dufflebunk at dufflebunk.homeip.net
Wed Jul 21 03:01:32 BST 2004

Hello, I have a program that uses odbc pooling which is segfaulting on
one computer, but not another. The backend DB is mysql, and the fault
actualy occurs in libmysqlclient.so. The crash happens when a connection
is openened, closed, and then opened again after the CPTimeout period.
I've written a small program to demonstrate this which crashes in the
same way as the big program. Here is the stack trace:
(gdb) where
#0  0x40257810 in vio_blocking () from /usr/lib/libmysqlclient.so.12
#1  0x40257d39 in net_clear () from /usr/lib/libmysqlclient.so.12
#2  0x402416e2 in simple_command () from /usr/lib/libmysqlclient.so.12
#3  0x40243fc0 in mysql_close () from /usr/lib/libmysqlclient.so.12
#4  0x4020532d in my_SQLDisconnect (hdbc=0x80644b4) at connect.c:802
#5  0x40205436 in SQLDisconnect (hdbc=0x80644b4) at connect.c:824
#6  0x4003a7e4 in close_pooled_connection (ptr=0x80639b0) at SQLConnect.c:2598
#7  0x4003aa1d in search_for_pool (connection=0x804a1c0, 
    server_name=0xbffed849 "ktparts-p", name_length1=-3, 
    user_name=0xbffed853 "mysql", name_length2=-3, 
    authentication=0xbffed859 "mysql", name_length3=-3, connect_string=0x0, 
    connect_string_length=0) at SQLConnect.c:2762
#8  0x4003b996 in SQLConnect (connection_handle=0x804a1c0, 
    server_name=0xbffed849 "ktparts-p", name_length1=-3, 
    user_name=0xbffed853 "mysql", name_length2=-3, 
    authentication=0xbffed859 "mysql", name_length3=-3) at SQLConnect.c:3357
#9  0x08048823 in main (argc=5, argv=0xbffeb8d4) at poolcrash.c:26

The versions (on both crashing and non-crashing machines):
unixODBC: 2.2.6 or 2.2.9
MyODBC: 3.51.06
MySQL: 4.0.16
It crashes on a computer with Red Hat ES, and doesn't crash on the
computer with Fedora Core 1, same hardware on each.

The odbc.ini and odbcinst.ini files are identical on both computers, the

The source for the minimal case, the produced core file, and the
compiled binary (compiled with gcc -g -lodbc poolcrash.c) are locate at
To run the program, 
./a.out <DSN> <username> <password> <time to wait before reconnect>
The time must be greater than CPTimeout for it to crash.

I don't know if this is a problem in the way I'm doing pooling, a bug in
unixODBC, MyODBC, or even MySQL. Any help would be apreciated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20040720/59a996e2/attachment.bin>

More information about the unixODBC-support mailing list