Bug #50535 mysql_stmt_prepare blocked if Connection IP lost
Submitted: 22 Jan 2010 7:55 Modified: 22 Apr 2010 19:44
Reporter: Ankur Garg Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / C Severity:S1 (Critical)
Version:mysql-connector-c-6.0.2-linux-glibc2.3-x OS:Linux (RHEL5)
Assigned to: Assigned Account CPU Architecture:Any

[22 Jan 2010 7:55] Ankur Garg
Description:
Setup: Running mysql server on two machine, both machine use a virtual ip one by one. Application using virtual ip to connect mysql server for data insertion, updation etc.

Problem: Application connected to mysql server using virtual ip and inserting data successfully. In between load if we shift virtual ip from my machine to another, queries blocked in mysql_stmt_prepare. This api not returning error but blocked.
Server Version:5.0.22 
Mysql options set:
l_reconnect = 1;
l_read_timeout=10;
mysql_options(mp_mysql_conn, MYSQL_OPT_RECONNECT, &l_reconnect);
mysql_options(mp_mysql_conn, MYSQL_OPT_READ_TIMEOUT, &l_read_timeout);

How to repeat:
Use virtual ip to connect to mysql server, after successful connection establishment during updation/insertiong load switch virtual ip to another mysql server and observe whether data updated in real time or not. In our case, thread got stuck in mysql_stmt_prepare and hanged.
[22 Jan 2010 10:23] Ankur Garg
Backtrace of thread which blocked in mysql_stmt_prepare

#0  0x0033b402 in __kernel_vsyscall ()
No symbol table info available.
#1  0x00427cbb in read () from /lib/libc.so.6
No symbol table info available.
#2  0x00a25f3d in vio_read (vio=0xfffffe00, buf=0x9e9203a8 "^", size=4)
    at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/vio/viosocket.c:44
        r = 4294966784
#3  0x0099a221 in my_real_read (net=0xb828780, complen=0x9cafb278)
    at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/net_serv.c:836
        pos = (uchar *) 0x9e9203a8 "^"
        length = 2660351704
        i = 0
        retry_count = 0
        len = 4294967295
        alarmed = 0 '\0'
        net_blocking = 1 '\001'
        remain = 4
#4  0x0099a016 in my_net_read (net=0xb828780) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/net_serv.c:1019
        len = 2660369320
        complen = 0
#5  0x0098ee3d in cli_safe_read (mysql=0xb828780) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/client.c:677
        len = 0
#6  0x009939da in cli_read_prepare_result (mysql=0xb828780, stmt=0xb8721d0)
    at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/libmysql.c:1498
        pos = (uchar *) 0x4 <Address 0x4 out of bounds>
        field_count = 193405392
        param_count = 2628760344
        packet_length = 2660369320
        fields_data = (MYSQL_DATA *) 0xfffffe00
#7  0x00993c9a in mysql_stmt_prepare (stmt=0xb8721d0,
    query=0x83bbab8 "insert into Instance1 values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", length=93)
    at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/libmysql.c:1694
        mysql = (MYSQL *) 0xb828780
[22 Mar 2010 19:44] Sveta Smirnova
Thank you for the report.

Please provide example of code demonstrating the problem: I want to be sure prepared statements are used properly.
[22 Apr 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".