当前位置: 技术问答>linux和unix
linux mysql c 客户端丢失链接后崩溃!
来源: 互联网 发布时间:2017-04-17
本文导语: mysql_real_query 调用此函数的时候返回一个错误 Lost connection to MySQL server during query 然后我程序就崩溃了。。。 怎么解决这个问题呐? 我用的是6.0.4的MYSQL C 库,用的.a 的 是不是用MYSQL。SO的好要点? 我程序...
mysql_real_query 调用此函数的时候返回一个错误
Lost connection to MySQL server during query
然后我程序就崩溃了。。。
怎么解决这个问题呐? 我用的是6.0.4的MYSQL C 库,用的.a 的 是不是用MYSQL。SO的好要点?
我程序没有任何问题,SQL语句也没问题,我们这边服务器网络不稳定,但是丢失链接后也不应该让我服务器崩溃啊
Lost connection to MySQL server during query
然后我程序就崩溃了。。。
怎么解决这个问题呐? 我用的是6.0.4的MYSQL C 库,用的.a 的 是不是用MYSQL。SO的好要点?
我程序没有任何问题,SQL语句也没问题,我们这边服务器网络不稳定,但是丢失链接后也不应该让我服务器崩溃啊
(gdb) bt
#0 0xb779c424 in __kernel_vsyscall ()
#1 0xb752c1df in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0xb752f825 in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0xb756939a in ?? () from /lib/i386-linux-gnu/libc.so.6
#4 0xb7573ee2 in ?? () from /lib/i386-linux-gnu/libc.so.6
#5 0xb72e904e in my_no_flags_free (ptr=0x0) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_malloc.c:65
#6 0xb72ca4a6 in end_server (mysql=0xb1d720b4) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/client.c:1033
#7 0xb72ca0fa in cli_safe_read (mysql=0xb1d720b4) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/client.c:688
#8 0xb72ccb36 in cli_read_query_result (mysql=0xb1d720b4) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/client.c:2825
#9 0xb72ccddc in mysql_real_query (mysql=0xb1d720b4,
query=0xb1d728bc "INSERT INTO `data_netflow_2013-04-18` (`host_ip`,`host_mac`,`up_flow`,`down_flow`,`http_up`,`http_down`,`http_total`,`smtp_up`,`smtp_down`,`smtp_total`,`pop3_up`,`pop3_down`,`pop3_total`,`ftp_up`,`ftp"..., length=510)
at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/client.c:2912
#10 0xb72c76d3 in CDataBase_MySQL::DataBase_MySQL_Execute (this=0xb7479f60 , xhNet=665,
lpszSQLQuery=0xb1d728bc "INSERT INTO `data_netflow_2013-04-18` (`host_ip`,`host_mac`,`up_flow`,`down_flow`,`http_up`,`http_down`,`http_total`,`smtp_up`,`smtp_down`,`smtp_total`,`pop3_up`,`pop3_down`,`pop3_total`,`ftp_up`,`ftp"...) at ./DataBase_MySql/DataBase_MySql.cpp:154
#11 0xb72c9d4a in DataBase_MySQL_Execute (xhData=665,
lpszSQLQuery=0xb1d728bc "INSERT INTO `data_netflow_2013-04-18` (`host_ip`,`host_mac`,`up_flow`,`down_flow`,`http_up`,`http_down`,`http_total`,`smtp_up`,`smtp_down`,`smtp_total`,`pop3_up`,`pop3_down`,`pop3_total`,`ftp_up`,`ftp"...) at ./DataBase_DllMain.cpp:45
#12 0xb773d651 in CLogicWork_Flow::LogicWork_Flow_InsertStorage (this=0xb7745030 , pSt_XMLFLow=0xb1d7312c) at ./Logic_ProWorkFlow/Logic_ProWorkFlow.cpp:55
#13 0xb7740fd5 in LogicWork_Flow_InsertStorage (pSt_XMLFLow=0xb1d7312c) at ./ProWork_DllMain.cpp:63
#14 0xb77300f0 in CDetachLayer_Dispatch::DetachLayer_Dispatch_Flow (this=0xb7738048 ,
lpszPacket=0xb0201d7a "::2ff:0:0:90db:75b73333000100022252217130000"..., nLen=413) at ./DetachLayer_Dispatch/DetachLayer_Dispatch.cpp:187
#15 0xb772fe77 in CDetachLayer_Dispatch::DetachLayer_Dispatch_Analyze (this=0xb7738048 , pSt_ProtocolHdr=0xb0201d70,
lpszPacket=0xb0201d7a "::2ff:0:0:90db:75b73333000100022252217130000"..., ptszBuffer=0x0, pInt_Len=0xb020259c) at ./DetachLayer_Dispatch/DetachLayer_Dispatch.cpp:74
#16 0xb7733d31 in DetachLayer_Dispatch_Analyze (pSt_ProtocolHdr=0xb0201d70,
lpszPacket=0xb0201d7a "::2ff:0:0:90db:75b73333000100022252217130000"..., ptszBuffer=0x0, pInt_Len=0xb020259c) at ./DetachLayer_DllMain.cpp:64
#17 0x0804a404 in NetCenter_PostTask (lParam=0xb0201d70) at ./NetCenter_Task.cpp:95
#18 0xb7753a21 in CManage_ThreadPool::ManagePool_Thread_Run (lParam=0x987c010) at ./ThreadPool/ThreadPool.cpp:601
#19 0xb74e9d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#20 0xb75ecd3e in clone () from /lib/i386-linux-gnu/libc.so.6
|
加保护啊,链路丢了,肯定要加容错处理的,这样程序才健壮一些。