https://bugs.kde.org/show_bug.cgi?id=465326

--- Comment #7 from Oded Arbel <o...@geek.co.il> ---
This crash still happens after tonight's neon unstable updates. I think it is
definitely related to klipper's HistoryModel::insert() operation: something in
the mutex there is causing an issue - if we look at the last (first?) 2 threads
from the stack trace (appended here is a new one from just about now), we can
see that "Thread 1" (LWP 585125) is not the main thread (like it is in most
back traces), its just a thread that was created to invoke qTerminate(), while
the main thread is "Thread 2"  (which has the earlier LWP id 550212) - and that
one is blocking in HistoryModel::insert(). This is also where plasmashell gets
stuck when it freezes on me - like it is right now, and then it crashed. Maybe
it is some kind of watchdog?

I tried to look at what could be deadlocking with the HistoryModel::insert()
mutex but (a) when backtracing a frozen plasmashell, I don't see anything else
holding a QMutexLocker, and (b) looking at the source code I can see that
HistoryModel exposes a pointer to its mutex using a public accessor, so anyone
can be locking it 🤷🤦.

Here's the last 2 threads from the (one of) the new crash:

Thread 2 (Thread 0x7fbc546629c0 (LWP 550212)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007fbc56ecea65 in QtLinuxFutex::_q_futex(int*, int, int, unsigned long
long, int*, int) (val3=0, addr2=0x0, val2=0, val=3, op=0, addr=0x564becec7268)
at thread/qfutex_p.h:114
#2  QtLinuxFutex::futexWait<QBasicAtomicPointer<QMutexData>
>(QBasicAtomicPointer<QMutexData>&, QBasicAtomicPointer<QMutexData>::Type)
(expectedValue=0x3, futex=...) at thread/qfutex_p.h:133
#3  lockInternal_helper<false> (timeout=-1, elapsedTimer=0x0, d_ptr=...) at
thread/qmutex_linux.cpp:142
#4  QBasicMutex::lockInternal() (this=0x564becec7268) at
thread/qmutex_linux.cpp:159
#5  0x00007fbc56eced73 in QBasicMutex::lock() (this=0x564becec7268) at
thread/qmutex.h:84
#6  QRecursiveMutexPrivate::lock(int) (this=0x564becec7250,
timeout=timeout@entry=-1) at thread/qmutex.cpp:780
#7  0x00007fbc56ecec69 in QMutex::lock() (this=this@entry=0x564becec6fd0) at
thread/qmutex.cpp:235
#8  0x00007fbbec059100 in QMutexLocker::QMutexLocker(QBasicMutex*)
(m=0x564becec6fd0, this=<synthetic pointer>) at
/usr/include/x86_64-linux-gnu/qt5/QtCore/qmutex.h:257
#9  QMutexLocker::QMutexLocker(QRecursiveMutex*) (m=0x564becec6fd0,
this=<synthetic pointer>) at
/usr/include/x86_64-linux-gnu/qt5/QtCore/qmutex.h:262
#10 HistoryModel::insert(std::shared_ptr<HistoryItem>) (this=0x564becec6fb0,
item=std::shared_ptr<HistoryItem> (use count 3, weak count 0) = {...}) at
./klipper/historymodel.cpp:135
#11 0x00007fbbec0540d2 in History::insert(std::shared_ptr<HistoryItem>)
(this=<optimized out>, item=std::shared_ptr<HistoryItem> (use count 3, weak
count 0) = {...}) at ./klipper/history.cpp:95
#12 0x00007fbbec03e166 in Klipper::applyClipChanges(QMimeData const*)
(this=this@entry=0x564bec263290, clipData=clipData@entry=0x564bf149c600) at
./klipper/klipper.cpp:687
#13 0x00007fbbec040a48 in Klipper::checkClipData(bool) (this=0x564bec263290,
selectionMode=<optimized out>) at ./klipper/klipper.cpp:828
#14 0x00007fbc570f40d4 in QtPrivate::QSlotObjectBase::call(QObject*, void**)
(a=0x7fffd0088e60, r=0x564bec263290, this=0x564becec6ad0) at
../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#15 doActivate<false>(QObject*, int, void**) (sender=0x564becec72b0,
signal_index=3, argv=0x7fffd0088e60) at kernel/qobject.cpp:3923
#16 0x00007fbc5650d0a2 in KSystemClipboard::changed(QClipboard::Mode) () at
/lib/x86_64-linux-gnu/libKF5GuiAddons.so.5
#17 0x00007fbc570f40d4 in QtPrivate::QSlotObjectBase::call(QObject*, void**)
(a=0x7fffd0088f10, r=0x564becec72b0, this=0x564becebf980) at
../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#18 doActivate<false>(QObject*, int, void**) (sender=0x564beaa64de0,
signal_index=3, argv=0x7fffd0088f10) at kernel/qobject.cpp:3923
#19 0x00007fbc58aa9e2e in ffi_call_unix64 () at ../src/x86/unix64.S:105
#20 0x00007fbc58aa6493 in ffi_call_int (cif=<optimized out>, fn=<optimized
out>, rvalue=<optimized out>, avalue=<optimized out>, closure=<optimized out>)
at ../src/x86/ffi64.c:672
#21 0x00007fbc59561b20 in  () at /lib/x86_64-linux-gnu/libwayland-client.so.0
#22 0x00007fbc595622c3 in  () at /lib/x86_64-linux-gnu/libwayland-client.so.0
#23 0x00007fbc595624bc in wl_display_dispatch_queue_pending () at
/lib/x86_64-linux-gnu/libwayland-client.so.0
#24 0x00007fbc5852338a in QtWaylandClient::QWaylandDisplay::flushRequests()
(this=<optimized out>) at ./src/client/qwaylanddisplay.cpp:253
#25 0x00007fbc570e9ade in QObject::event(QEvent*) (this=0x564beaa4ab50,
e=0x7fbc48008100) at kernel/qobject.cpp:1347
#26 0x00007fbc57d6c793 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
(this=<optimized out>, receiver=0x564beaa4ab50, e=0x7fbc48008100) at
kernel/qapplication.cpp:3640
#27 0x00007fbc570bc07a in QCoreApplication::notifyInternal2(QObject*, QEvent*)
(receiver=0x564beaa4ab50, event=0x7fbc48008100) at
kernel/qcoreapplication.cpp:1064
#28 0x00007fbc570bf167 in QCoreApplicationPrivate::sendPostedEvents(QObject*,
int, QThreadData*) (receiver=0x0, event_type=0, data=0x564beaa21ec0) at
kernel/qcoreapplication.cpp:1821
#29 0x00007fbc57116487 in postEventSourceDispatch(GSource*, GSourceFunc,
gpointer) (s=0x564beaa63cc0) at kernel/qeventdispatcher_glib.cpp:277
#30 0x00007fbc55c95569 in g_main_dispatch (context=0x7fbc4c005010) at
../../../glib/gmain.c:3444
#31 g_main_context_dispatch (context=0x7fbc4c005010) at
../../../glib/gmain.c:4162
#32 0x00007fbc55cea3c8 in g_main_context_iterate.constprop.0
(context=0x7fbc4c005010, block=<optimized out>, dispatch=1, self=<optimized
out>) at ../../../glib/gmain.c:4238
#33 0x00007fbc55c92d20 in g_main_context_iteration (context=0x7fbc4c005010,
may_block=1) at ../../../glib/gmain.c:4303
#34 0x00007fbc57115ad8 in
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
(this=0x564beaa76140, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#35 0x00007fbc570ba99b in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
(this=this@entry=0x7fffd00896d0, flags=..., flags@entry=...) at
../../include/QtCore/../../src/corelib/global/qflags.h:69
#36 0x00007fbc570c2f34 in QCoreApplication::exec() () at
../../include/QtCore/../../src/corelib/global/qflags.h:121
#37 0x00007fbc575364d0 in QGuiApplication::exec() () at
kernel/qguiapplication.cpp:1870
#38 0x00007fbc57d6c709 in QApplication::exec() () at
kernel/qapplication.cpp:2832
#39 0x0000564bea819a8b in main(int, char**) (argc=<optimized out>,
argv=<optimized out>) at ./shell/main.cpp:235

Thread 1 (Thread 0x7fbb8deff6c0 (LWP 585125)):
[KCrash Handler]
#6  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)
at ./nptl/pthread_kill.c:44
#7  __pthread_kill_internal (signo=6, threadid=<optimized out>) at
./nptl/pthread_kill.c:78
#8  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at
./nptl/pthread_kill.c:89
#9  0x00007fbc5663bc46 in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
#10 0x00007fbc566227fc in __GI_abort () at ./stdlib/abort.c:79
#11 0x00007fbc56aa2b9e in __gnu_cxx::__verbose_terminate_handler() () at
../../../../src/libstdc++-v3/libsupc++/vterminate.cc:95
#12 0x00007fbc56aae34c in __cxxabiv1::__terminate(void (*)())
(handler=<optimized out>) at
../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:48
#13 0x00007fbc56aae3b7 in std::terminate() () at
../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:58
#14 0x00007fbc56e90f91 in qTerminate() () at global/qglobal.cpp:3382
#15 0x00007fbc56e92e3c in QThreadPrivate::start(void*) (arg=0x7fbbf8005190) at
thread/qthread_unix.cpp:342
#16 0x00007fbc56690402 in start_thread (arg=<optimized out>) at
./nptl/pthread_create.c:442
#17 0x00007fbc5671f590 in clone3 () at
../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

And here's "Thread 1" from backtracing plasmashell when it freezes on me:

Thread 1 (Thread 0x7fe1c4d3d9c0 (LWP 601294) "plasmashell"):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007fe1c90cea65 in QtLinuxFutex::_q_futex(int*, int, int, unsigned long
long, int*, int) (val3=0, addr2=0x0, val2=0, val=3, op=0, addr=0x56218cefa708)
at thread/qfutex_p.h:114
#2  QtLinuxFutex::futexWait<QBasicAtomicPointer<QMutexData>
>(QBasicAtomicPointer<QMutexData>&, QBasicAtomicPointer<QMutexData>::Type)
(expectedValue=0x3, futex=...) at thread/qfutex_p.h:133
#3  lockInternal_helper<false> (timeout=-1, elapsedTimer=0x0, d_ptr=...) at
thread/qmutex_linux.cpp:142
#4  QBasicMutex::lockInternal() (this=0x56218cefa708) at
thread/qmutex_linux.cpp:159
#5  0x00007fe1c90ced73 in QBasicMutex::lock() (this=0x56218cefa708) at
thread/qmutex.h:84
#6  QRecursiveMutexPrivate::lock(int) (this=0x56218cefa6f0,
timeout=timeout@entry=-1) at thread/qmutex.cpp:780
#7  0x00007fe1c90cec69 in QMutex::lock() (this=this@entry=0x56218cefaad0) at
thread/qmutex.cpp:235
#8  0x00007fe157f41100 in QMutexLocker::QMutexLocker(QBasicMutex*)
(m=0x56218cefaad0, this=<synthetic pointer>) at
/usr/include/x86_64-linux-gnu/qt5/QtCore/qmutex.h:257
#9  QMutexLocker::QMutexLocker(QRecursiveMutex*) (m=0x56218cefaad0,
this=<synthetic pointer>) at
/usr/include/x86_64-linux-gnu/qt5/QtCore/qmutex.h:262
#10 HistoryModel::insert(std::shared_ptr<HistoryItem>) (this=0x56218cefaab0,
item=std::shared_ptr<HistoryItem> (use count 3, weak count 0) = {...}) at
./klipper/historymodel.cpp:135
#11 0x00007fe157f3c0d2 in History::insert(std::shared_ptr<HistoryItem>)
(this=<optimized out>, item=std::shared_ptr<HistoryItem> (use count 3, weak
count 0) = {...}) at ./klipper/history.cpp:95
#12 0x00007fe157f26166 in Klipper::applyClipChanges(QMimeData const*)
(this=this@entry=0x56218c3e1ab0, clipData=clipData@entry=0x5621931befa0) at
./klipper/klipper.cpp:687
#13 0x00007fe157f28a48 in Klipper::checkClipData(bool) (this=0x56218c3e1ab0,
selectionMode=<optimized out>) at ./klipper/klipper.cpp:828
#14 0x00007fe1c92f40d4 in QtPrivate::QSlotObjectBase::call(QObject*, void**)
(a=0x7ffe977ce270, r=0x56218c3e1ab0, this=0x56218cefa590) at
../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#15 doActivate<false>(QObject*, int, void**) (sender=0x56218cef6ec0,
signal_index=3, argv=0x7ffe977ce270) at kernel/qobject.cpp:3923
#16 0x00007fe1c8a230a2 in KSystemClipboard::changed(QClipboard::Mode) () at
/lib/x86_64-linux-gnu/libKF5GuiAddons.so.5
#17 0x00007fe1c92f40d4 in QtPrivate::QSlotObjectBase::call(QObject*, void**)
(a=0x7ffe977ce320, r=0x56218cef6ec0, this=0x56218ceeb740) at
../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#18 doActivate<false>(QObject*, int, void**) (sender=0x56218adc8e00,
signal_index=3, argv=0x7ffe977ce320) at kernel/qobject.cpp:3923
#19 0x00007fe1cb393e2e in ffi_call_unix64 () at ../src/x86/unix64.S:105
#20 0x00007fe1cb390493 in ffi_call_int (cif=<optimized out>, fn=<optimized
out>, rvalue=<optimized out>, avalue=<optimized out>, closure=<optimized out>)
at ../src/x86/ffi64.c:672
#21 0x00007fe1cb860b20 in  () at /lib/x86_64-linux-gnu/libwayland-client.so.0
#22 0x00007fe1cb8612c3 in  () at /lib/x86_64-linux-gnu/libwayland-client.so.0
#23 0x00007fe1cb8614bc in wl_display_dispatch_queue_pending () at
/lib/x86_64-linux-gnu/libwayland-client.so.0
#24 0x00007fe1cad2338a in QtWaylandClient::QWaylandDisplay::flushRequests()
(this=<optimized out>) at ./src/client/qwaylanddisplay.cpp:253
#25 0x00007fe1c92e9ade in QObject::event(QEvent*) (this=0x56218adaeb50,
e=0x7fe1b4006ba0) at kernel/qobject.cpp:1347
#26 0x00007fe1ca16c793 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
(this=<optimized out>, receiver=0x56218adaeb50, e=0x7fe1b4006ba0) at
kernel/qapplication.cpp:3640
#27 0x00007fe1c92bc07a in QCoreApplication::notifyInternal2(QObject*, QEvent*)
(receiver=0x56218adaeb50, event=0x7fe1b4006ba0) at
kernel/qcoreapplication.cpp:1064
#28 0x00007fe1c92bf167 in QCoreApplicationPrivate::sendPostedEvents(QObject*,
int, QThreadData*) (receiver=0x0, event_type=0, data=0x56218ad85ec0) at
kernel/qcoreapplication.cpp:1821
#29 0x00007fe1c9316487 in postEventSourceDispatch(GSource*, GSourceFunc,
gpointer) (s=0x56218adc7ce0) at kernel/qeventdispatcher_glib.cpp:277
#30 0x00007fe1c7f85569 in g_main_dispatch (context=0x7fe1bc005010) at
../../../glib/gmain.c:3444
#31 g_main_context_dispatch (context=0x7fe1bc005010) at
../../../glib/gmain.c:4162
#32 0x00007fe1c7fda3c8 in g_main_context_iterate.constprop.0
(context=0x7fe1bc005010, block=<optimized out>, dispatch=1, self=<optimized
out>) at ../../../glib/gmain.c:4238
#33 0x00007fe1c7f82d20 in g_main_context_iteration (context=0x7fe1bc005010,
may_block=1) at ../../../glib/gmain.c:4303
#34 0x00007fe1c9315ad8 in
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
(this=0x56218adda3c0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#35 0x00007fe1c92ba99b in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
(this=this@entry=0x7ffe977ceae0, flags=..., flags@entry=...) at
../../include/QtCore/../../src/corelib/global/qflags.h:69
#36 0x00007fe1c92c2f34 in QCoreApplication::exec() () at
../../include/QtCore/../../src/corelib/global/qflags.h:121
#37 0x00007fe1c97364d0 in QGuiApplication::exec() () at
kernel/qguiapplication.cpp:1870
#38 0x00007fe1ca16c709 in QApplication::exec() () at
kernel/qapplication.cpp:2832
#39 0x0000562189027a8b in main(int, char**) (argc=<optimized out>,
argv=<optimized out>) at ./shell/main.cpp:235

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to