我有一个具有HTTP Server自定义实现的应用程序 它使用HTTPRequest类来解析HTTP Request,RequestHandler类来处理调用和断开连接事件。服务器是多线程的,但Scanner对象是单线程的。
应用程序随机间隔崩溃,因此我无法重现此错误,因为它在生产级别运行,我无法对调试进行微小更改,我还尝试使用apache bench ab
进行100并行测试请求但没有崩溃。
我搜索了同样的错误,却一无所获。扫描仪对象永远不会被破坏。那么下面的堆栈跟踪意味着什么?
backtrace:#0 0x000000000040909c in Scanner::stopScanner (this=0x0) at ../src/scanner.cpp:118
No locals.
#1 0x00000000004146b2 in RequestHandler::disconnected (this=0x9ac1c0) at ../src/requesthandler.cpp:100
No locals.
#2 0x0000000000417721 in RequestHandler::qt_static_metacall (_o=0x9ac1c0, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fff7fffe300) at moc_requesthandler.cpp:83
_t = 0x9ac1c0
#3 0x00007ffff396f01a in QMetaObject::activate(QObject*, int, int, void**) () from /root/libs/libQt5Core.so.5
No symbol table info available.
#4 0x000000000041732f in HTTPRequest::disconnected (this=0x7fff6c00c8d0) at moc_httprequest.cpp:203
No locals.
#5 0x00000000004119ce in HTTPRequest::tcpdisconnected (this=0x7fff6c00c8d0) at ../src/qfoobar/httpserver/httprequest.cpp:183
No locals.
#6 0x0000000000416dce in HTTPRequest::qt_static_metacall (_o=0x7fff6c00c8d0, _c=QMetaObject::InvokeMetaMethod, _id=3, _a=0x7fff7fffe500) at moc_httprequest.cpp:126
_t = 0x7fff6c00c8d0
#7 0x00007ffff396f01a in QMetaObject::activate(QObject*, int, int, void**) () from /root/libs/libQt5Core.so.5
No symbol table info available.
#8 0x00007ffff42fcaa8 in QAbstractSocket::disconnectFromHost() () from /root/libs/libQt5Network.so.5
No symbol table info available.
#9 0x00007ffff42fb439 in ?? () from /root/libs/libQt5Network.so.5
No symbol table info available.
#10 0x00007ffff42fb8cc in ?? () from /root/libs/libQt5Network.so.5
No symbol table info available.
#11 0x00007ffff430520f in ?? () from /root/libs/libQt5Network.so.5
No symbol table info available.
#12 0x00007ffff746d2b4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /root/libs/libQt5Widgets.so.5
No symbol table info available.
#13 0x00007ffff7470c86 in QApplication::notify(QObject*, QEvent*) () from /root/libs/libQt5Widgets.so.5
No symbol table info available.
#14 0x00007ffff393ce24 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /root/libs/libQt5Core.so.5
No symbol table info available.
#15 0x00007ffff3996bc2 in ?? () from /root/libs/libQt5Core.so.5
No symbol table info available.
#16 0x00007ffff1ed6e04 in g_main_context_dispatch () from /root/libs/libglib-2.0.so.0
No symbol table info available.
#17 0x00007ffff1ed7048 in ?? () from /root/libs/libglib-2.0.so.0
No symbol table info available.
#18 0x00007ffff1ed70ec in g_main_context_iteration () from /root/libs/libglib-2.0.so.0
No symbol table info available.
#19 0x00007ffff39975e4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /root/libs/libQt5Core.so.5
No symbol table info available.
#20 0x00007ffff393b04b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /root/libs/libQt5Core.so.5
No symbol table info available.
#21 0x00007ffff370277a in QThread::exec() () from /root/libs/libQt5Core.so.5
No symbol table info available.
#22 0x0000000000414a52 in HTTPRequestHandler::run (this=0x9ac1c0) at ../src/qfoobar/httpserver/httprequesthandler.cpp:30
No locals.
#23 0x00007ffff3708434 in ?? () from /root/libs/libQt5Core.so.5
No symbol table info available.
#24 0x00007ffff23ef182 in start_thread () from /root/libs/libpthread.so.0
No symbol table info available.
#25 0x00007ffff2e0847d in clone () from /root/libs/libc.so.6
No symbol table info available.
答案 0 :(得分:1)
问题在于:
Scanner::stopScanner (this=0x0)
因此,使用not-an-object调用您的stopScanner
方法。在下面,您可以看到RequestHandler::disconnected (this=0x9ac1c0)
,因此似乎disconnected
方法使用空stopScanner
指针调用Scanner
。