Segmentation Faultwith QAbstractSocketPrivate and QTimer
-
Recently we've run into an issue with our Qt6 tool where the program encounters a segmentation fault while running. From the backtrace (see below) it seems to be entirely internal to Qt, as it never references our code at any point.
This occurs both on Manjaro running Qt 6.8.2-3, and within a Flatpak which runs Qt 6.8.3 (from the org.kde.Platform runtime). This issue also did not occur a week or so ago, so we believe it to be possibly the result of a Qt update.
Any direction or help in solving the problem would be greatly appreciated.
#0 QTimer::stop (this=0x7fff1c0154e0) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qtimer.cpp:268 #1 0x00007fffeac5d49e in QAbstractSocketPrivate::resetSocketLayer (this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/network/socket/qabstractsocket.cpp:528 #2 0x00007fffeac5d714 in QAbstractSocketPrivate::readFromSocket (this=this@entry=0x7fff1c010c50) at /usr/src/debug/qt6-base/qtbase/src/network/socket/qabstractsocket.cpp:1203 #3 0x00007fffeac5d791 in QAbstractSocketPrivate::canReadNotification (this=0x7fff1c010c50) at /usr/src/debug/qt6-base/qtbase/src/network/socket/qabstractsocket.cpp:626 #4 0x00007fffeac698d2 in QAbstractSocketEngine::readNotification (this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/network/socket/qabstractsocketengine.cpp:120 #5 QReadNotifier::event (this=<optimized out>, e=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/network/socket/qnativesocketengine.cpp:1238 #6 0x00007fffebeff0ca in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x7fff280168d0, e=0x7ffe00fefd60) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3296 #7 0x00007fffea355b00 in QCoreApplication::notifyInternal2 (receiver=0x7fff280168d0, event=0x7ffe00fefd60) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1172 #8 0x00007fffea5c80f1 in QCoreApplication::sendEvent (receiver=<optimized out>, event=0x7ffe00fefd60) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1612 #9 socketNotifierSourceDispatch (source=source@entry=0x7fff1c003570) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:77 #10 0x00007fffe8506104 in g_main_dispatch (context=0x7fff1c003370) at ../glib/glib/gmain.c:3398 #11 0x00007fffe8569d57 in g_main_context_dispatch_unlocked (context=0x7fff1c003370) at ../glib/glib/gmain.c:4249 #12 g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7fff1c003370, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4314 #13 0x00007fffe8505535 in g_main_context_iteration (context=0x7fff1c003370, may_block=1) at ../glib/glib/gmain.c:4379 #14 0x00007fffea5c5782 in QEventDispatcherGlib::processEvents (this=0x7fff1c004160, flags=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:401 #15 0x00007fffea3606a6 in QEventLoop::processEvents (this=0x7ffe00ff0030, flags=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:103 #16 QEventLoop::exec (this=0x7ffe00ff0030, flags=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:185 #17 0x00007fffea457999 in QThread::exec (this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qthread.cpp:590 #18 QThread::run (this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qthread.cpp:711 #19 0x00007fffea4d8a9b in operator() (__closure=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qthread_unix.cpp:375 #20 (anonymous namespace)::terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> > (t=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qthread_unix.cpp:311 #21 QThreadPrivate::start (arg=0x5555575a67f0) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qthread_unix.cpp:339 #22 0x00007fffe9ca370a in start_thread (arg=<optimized out>) at pthread_create.c:448 #23 0x00007fffe9d27aac in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
-
You must not access a Qobject from outside its owning thread what you likely do.
If not please provide a minimal compileable example of the problem. -
Unfortunately we aren't able to figure out where the problem is coming from exactly, so I cannot provide you with a minimal example; and I am also unable to give you the source-code since it is internal to our organization.
Your answer, however, has been useful and I think I have an idea of what the problem may be. Thank you.