当前位置: 技术问答>linux和unix
崩溃堆栈,为什么会出错。
来源: 互联网 发布时间:2017-04-07
本文导语: mysql C版本为 6.0.2 运行不了多久就崩溃了。。。。刚开始是好好的,我还以为是SQL语句有问题,我打印出来直接放到工具里面运行很正常啊。。。为什么崩溃了呢? 代码如下: DataBase_IsErrorOccur = FALSE; NETDATA...
mysql C版本为 6.0.2
运行不了多久就崩溃了。。。。刚开始是好好的,我还以为是SQL语句有问题,我打印出来直接放到工具里面运行很正常啊。。。为什么崩溃了呢?
代码如下:
崩溃如下所示
运行不了多久就崩溃了。。。。刚开始是好好的,我还以为是SQL语句有问题,我打印出来直接放到工具里面运行很正常啊。。。为什么崩溃了呢?
代码如下:
DataBase_IsErrorOccur = FALSE;
NETDATABASE_MYSQLHANDLE st_hDatabaseMySQL;
memset(&st_hDatabaseMySQL,'',sizeof(st_hDatabaseMySQL));
if (!m_hNetComponents.NetEngine_LibHandleEx_Get(xhNet,&st_hDatabaseMySQL))
{
return FALSE;
}
//撤消自动提交模式
if (0 != mysql_autocommit(&st_hDatabaseMySQL.st_MySQL,FALSE))
{
DataBase_IsErrorOccur = TRUE;
DataBase_dwErrorCode = ERROR_HELPCOMPONENTS_DATABASE_MYSQL_EXEC_CANCEAUTOCOMMIT;
return FALSE;
}
//执行SQL语句
if (0 != mysql_query(&st_hDatabaseMySQL.st_MySQL,lpszSQLQuery))
{
printf("数据库查询错误:%s,SQL语句:%sn",mysql_error(&st_hDatabaseMySQL.st_MySQL),lpszSQLQuery);
DataBase_IsErrorOccur = TRUE;
DataBase_dwErrorCode = ERROR_HELPCOMPONENTS_DATABASE_MYSQL_EXEC_ISFAILED;
return FALSE;
}
//如果没有成功
if (0 != mysql_commit(&st_hDatabaseMySQL.st_MySQL))
{
//回滚事务
mysql_rollback(&st_hDatabaseMySQL.st_MySQL);
mysql_autocommit(&st_hDatabaseMySQL.st_MySQL,TRUE);
DataBase_IsErrorOccur = TRUE;
DataBase_dwErrorCode = ERROR_HELPCOMPONENTS_DATABASE_MYSQL_EXEC_COMMIT;
return FALSE;
}
//恢复自动提交模式
if (0 != mysql_autocommit(&st_hDatabaseMySQL.st_MySQL,TRUE))
{
DataBase_IsErrorOccur = TRUE;
DataBase_dwErrorCode = ERROR_HELPCOMPONENTS_DATABASE_MYSQL_EXEC_AUTOCOMMIT;
return FALSE;
}
return TRUE;
崩溃如下所示
(gdb) bt
#0 0xb7767424 in __kernel_vsyscall ()
#1 0xb74f71df in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0xb74fa825 in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0xb753439a in ?? () from /lib/i386-linux-gnu/libc.so.6
#4 0xb753eee2 in ?? () from /lib/i386-linux-gnu/libc.so.6
#5 0xb72b3e9e 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 0xb72952f6 in end_server (mysql=0xb35400dc) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/client.c:1033
#7 0xb7294f4a in cli_safe_read (mysql=0xb35400dc) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/client.c:688
#8 0xb7297986 in cli_read_query_result (mysql=0xb35400dc) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/client.c:2825
#9 0xb7297c2c in mysql_real_query (mysql=0xb35400dc, query=0xb7317162 "commit", length=6)
at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/client.c:2912
#10 0xb729c019 in mysql_commit (mysql=0xb35400dc) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/libmysql.c:4778
#11 0xb7292676 in CDataBase_MySQL::DataBase_MySQL_Execute (this=0xb7444f60 , xhNet=3897,
lpszSQLQuery=0xb35408cc "INSERT INTO `data_netflow_2013-04-17` (`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:157
#12 0xb7294bce in DataBase_MySQL_Execute (xhData=3897,
lpszSQLQuery=0xb35408cc "INSERT INTO `data_netflow_2013-04-17` (`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
#13 0xb77085e5 in CLogicWork_Flow::LogicWork_Flow_InsertStorage (this=0xb7710030 , pSt_XMLFLow=0xb354113c) at ./Logic_ProWorkFlow/Logic_ProWorkFlow.cpp:55
#14 0xb770bfa5 in LogicWork_Flow_InsertStorage (pSt_XMLFLow=0xb354113c) at ./ProWork_DllMain.cpp:63
#15 0xb76fb0d8 in CDetachLayer_Dispatch::DetachLayer_Dispatch_Flow (this=0xb7703048 ,
lpszPacket=0xb0200472 "192.168.16.24994:DE:80:50:31:320000000"..., nLen=399) at ./DetachLayer_Dispatch/DetachLayer_Dispatch.cpp:187
#16 0xb76fae67 in CDetachLayer_Dispatch::DetachLayer_Dispatch_Analyze (this=0xb7703048 , pSt_ProtocolHdr=0xb0200468,
lpszPacket=0xb0200472 "192.168.16.24994:DE:80:50:31:320000000"..., ptszBuffer=0x0, pInt_Len=0xb0200c94) at ./DetachLayer_Dispatch/DetachLayer_Dispatch.cpp:74
#17 0xb76fed19 in DetachLayer_Dispatch_Analyze (pSt_ProtocolHdr=0xb0200468,
lpszPacket=0xb0200472 "192.168.16.24994:DE:80:50:31:320000000"..., ptszBuffer=0x0, pInt_Len=0xb0200c94) at ./DetachLayer_DllMain.cpp:64
#18 0x0804a402 in NetCenter_PostTask (lParam=0xb0200468) at ./NetCenter_Task.cpp:95
#19 0xb771ea21 in CManage_ThreadPool::ManagePool_Thread_Run (lParam=0x8fcfbd8) at ./ThreadPool/ThreadPool.cpp:601
#20 0xb74b4d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#21 0xb75b7d3e in clone () from /lib/i386-linux-gnu/libc.so.6
(gdb)
|
自己malloc后ptr为空?
#5 0xb72b3e9e 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
#5 0xb72b3e9e 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
|
……不太清楚了...gdb调试吧
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。