由优化器引起的段错误

时间:2012-10-02 07:18:07

标签: java curl gdb xml-rpc

使用gdb跟踪日志时遇到一个问题 。当XMLRPC调用和gdb backtrace显示时系统崩溃:

Program terminated with signal 11, Segmentation fault.
#0  finishCurlMulti (envP=0x0, curlMultiP=0xe37b800, timeoutType=timeout_no, 
    deadline=..., interruptP=0x0) at xmlrpc_curl_transport.c:572

warning: Source file is more recent than executable.
572
(gdb) bt
#0  finishCurlMulti (envP=0x0, curlMultiP=0xe37b800, timeoutType=timeout_no, 
    deadline=..., interruptP=0x0) at xmlrpc_curl_transport.c:572
#1  0x00002b84f0b4ad24 in performCurlTransaction (envP=0x46a185d0, 
    clientTransportP=0xe365d50, serverP=<value optimized out>, 
    callXmlP=<value optimized out>, responseXmlPP=0x46a185e8)
    at xmlrpc_curl_transport.c:1036
#2  performRpc (envP=0x46a185d0, clientTransportP=0xe365d50, 
    serverP=<value optimized out>, callXmlP=<value optimized out>, 
    responseXmlPP=0x46a185e8) at xmlrpc_curl_transport.c:1141
#3  call (envP=0x46a185d0, clientTransportP=0xe365d50, 
    serverP=<value optimized out>, callXmlP=<value optimized out>, 
    responseXmlPP=0x46a185e8) at xmlrpc_curl_transport.c:1362

===&GT;是否有空指针错误? envP =为0x0

------------------------------------- trace frame 1 ------- -------------

(gdb) frame 1
#1  0x00002b84f0b4ad24 in performCurlTransaction (envP=0x46a185d0, clientTransportP=0xe365d50, serverP=<value optimized out>, callXmlP=<value optimized out>, 
    responseXmlPP=0x46a185e8) at xmlrpc_curl_transport.c:1036
1036               synchronous RPC can be in progress is for the 'perform' method
(gdb) print envP
$1 = <value optimized out>
(gdb) info registers
rax            0x0      0
rbx            0xec59270        247829104
rcx            0x0      0
rdx            0x2      2
rsi            0x46a18200       1184989696
rdi            0xe37b800        238532608
rbp            0x46a185d0       0x46a185d0
rsp            0x46a184e0       0x46a184e0
r8             0x46a17f00       1184988928
r9             0x46a17ef0       1184988912
r10            0x46a18100       1184989440
r11            0x206    518
r12            0xe365d50        238443856
r13            0xe37b800        238532608
r14            0xe99dda0        244964768
r15            0x46a185e8       1184990696
rip            0x2b84f0b4ad24   0x2b84f0b4ad24 <call+340>
eflags         0x10206  [ PF IF RF ]
cs             0x33     51
ss             0xe02b   57387
ds             0x0      0
es             0x0      0
fs             0x63     99
gs             0x0      0
fctrl          0x37f    895
fstat          0x0      0
ftag           0xffff   65535
fiseg          0x0      0
fioff          0x0      0
foseg          0x0      0
fooff          0x0      0
fop            0x0      0
mxcsr          0x1fa0   [ PE IM DM ZM OM UM PM ]

======&GT;在envP商店注册rbp?

------------------------回到第0帧-------------------

(gdb) frame 0
#0  finishCurlMulti (envP=0x0, curlMultiP=0xe37b800, timeoutType=timeout_no, deadline=..., interruptP=0x0) at xmlrpc_curl_transport.c:572
572
(gdb) print envP
$2 = (xmlrpc_env * const) 0x0
(gdb) info register
rax            0x0      0
rbx            0x0      0
rcx            0x0      0
rdx            0x2      2
rsi            0x46a18200       1184989696
rdi            0xe37b800        238532608
rbp            0xe37b800        0xe37b800
rsp            0x46a182f0       0x46a182f0
r8             0x46a17f00       1184988928
r9             0x46a17ef0       1184988912
r10            0x46a18100       1184989440
r11            0x206    518
r12            0x0      0
r13            0x0      0
r14            0x0      0
r15            0x0      0
rip            0x2b84f0b49e93   0x2b84f0b49e93 <finishCurlMulti+259>
eflags         0x10206  [ PF IF RF ]
cs             0x33     51
ss             0xe02b   57387
ds             0x0      0
es             0x0      0
fs             0x63     99
gs             0x0      0
fctrl          0x37f    895
fstat          0x0      0
ftag           0xffff   65535
fiseg          0x0      0
fioff          0x0      0
foseg          0x0      0
fooff          0x0      0
fop            0x0      0
mxcsr          0x1fa0   [ PE IM DM ZM OM UM PM ]

======&GT;请告诉我这个案子有什么问题?

我正在尝试使用-O0来禁用优化器,但我不确定。

感谢。

这是我的正确源文件的回溯:

#0  finishCurlMulti (envP=0x0, curlMultiP=0x12e2580, timeoutType=timeout_yes, deadline=..., interruptP=0x0) at xmlrpc_curl_transport.c:572
#1  0x00002abe7f51d0b4 in finishAsynch (clientTransportP=0x12e24c0, timeoutType=timeout_yes, timeout=10000) at xmlrpc_curl_transport.c:1301
#2  0x00002abe7f72f5c6 in xmlrpc_c::clientXmlTransport_http::finishAsync (this=0x12e2470, timeout=...) at client.cpp:624
#3  0x00002abe7f72f64a in xmlrpc_c::client_xml::finishAsync (this=0x1304bf0, timeout=...) at client.cpp:893
#4  0x00002aaaab57c26d in UrlStruct::runXmlRpc (this=0x122d140, method="mediacontrol.onEvent", paramList=<value optimized out>, result=<value optimized out>) at Utils.cpp:146
#5  0x00002aaaab57c526 in IVRUtils::executeXmlRpc (controllerUrl=0x12e2580, methodName=Traceback (most recent call last):   
#6  0x00002aaaab54366a in IvrCoreSession::_exec_xmlrpc_cmd (this=0x2aaab48277f0, paramList=..., result=0x41228cb0) at IvrCoreSession.cpp:307
#7  0x00002aaaab544c95 in IvrCoreSession::fireEndCallEvent (this=0x2aaab48277f0) at IvrCoreSession.cpp:504
#8  0x00002aaaab54752d in IvrCoreSession::~IvrCoreSession (this=0x2aaab48277f0, __in_chrg=<value optimized out>) at IvrCoreSession.cpp:101
#9  0x000000000047c15d in AmSessionContainer::clean_sessions (this=0x10cbdd0) at AmSessionContainer.cpp:94
#10 0x000000000047c898 in AmSessionContainer::run (this=0x10cbdd0) at AmSessionContainer.cpp:132
#11 0x000000000049266c in AmThread::_start (_t=<value optimized out>) at AmThread.cpp:70
#12 0x000000397ec0673d in start_thread () from /lib64/libpthread.so.0
#13 0x000000397e0d40cd in clone () from /lib64/libc.so.6 

此错误每6天发生一次。我们使用xmlrpc-c lib和curl构建选项 - enable-threaded-resolver 。请给我们一些想法 感谢。

1 个答案:

答案 0 :(得分:1)

这看起来很危险:

  

警告:源文件比可执行文件更新

这意味着调试符号与您的源代码不匹配。建立并再试一次;你可能正在寻找一个已经修复过的bug。

同时检查位于performCurlTransaction()的{​​{1}}中的代码,因为此功能获得xmlrpc_curl_transport.c:1036,但会使用envP != null调用finishCurlMulti