Bug 486286 - Excessive use of wl-clipboard crashes plasmashell in Klipper::checkClipData() while trying to create a QR code
Summary: Excessive use of wl-clipboard crashes plasmashell in Klipper::checkClipData()...
Status: RESOLVED DUPLICATE of bug 489096
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard (show other bugs)
Version: 6.0.4
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: drkonqi, wayland
Depends on:
Blocks:
 
Reported: 2024-04-29 10:06 UTC by Kiril Vladimirov
Modified: 2024-07-22 20:23 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
New crash information added by DrKonqi (176.33 KB, text/plain)
2024-04-29 10:06 UTC, Kiril Vladimirov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kiril Vladimirov 2024-04-29 10:06:36 UTC
Application: plasmashell (6.0.4)

Qt Version: 6.7.0
Frameworks Version: 6.1.0
Operating System: Linux 6.8.7-300.fc40.x86_64 x86_64
Windowing System: Wayland
Distribution: "Fedora release 40 (Forty)"
DrKonqi: 6.0.4 [CoredumpBackend]

-- Information about the crash:
Created a script that uses wl-copy and wl-paste a lot (i.e. a tens of times per second) by sending and receiving a lot of data (about ~100K). That script was running fine for a few seconds and then plasmashell started crashing. Until the clipboard got cleared, the crash was reproducible on every single copy->paste operation.

I'm still not able to create a 100% reproducible case, but posting this in order not to lose the traceback.

The crash can be reproduced sometimes.

-- Backtrace (Reduced):
#5  0x00007f5b095e3907 in QMimeData::hasText (this=this@entry=0x563cc0d96d20) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qmimedata.cpp:408
#6  0x00007f5aba1a98ac in Klipper::checkClipData (this=0x7f5a1401be80, selectionMode=<optimized out>) at /usr/src/debug/plasma-workspace-6.0.4-1.fc40.x86_64/klipper/klipper.cpp:785
#7  0x00007f5b095fa3f4 in QtPrivate::QSlotObjectBase::call (this=0x563cc0d0e2f0, r=<optimized out>, a=0x7ffc279288e0) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qobjectdefs_impl.h:469
#8  doActivate<false> (sender=0x563cc0d0d390, signal_index=3, argv=0x7ffc279288e0) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qobject.cpp:4078
[...]
#10 0x00007f5b08d8f0b0 in KSystemClipboard::changed (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/kf6-kguiaddons-6.1.0-2.fc40.x86_64/redhat-linux-build/src/KF6GuiAddons_autogen/include/moc_ksystemclipboard.cpp:142


Reported using DrKonqi
Comment 1 Kiril Vladimirov 2024-04-29 10:06:37 UTC
Created attachment 168993 [details]
New crash information added by DrKonqi

DrKonqi auto-attaching complete backtrace.
Comment 2 Nate Graham 2024-06-21 03:00:19 UTC
Thread 1 (Thread 0x7f5b046c1b00 (LWP 15983)):
[KCrash Handler]
#5  0x00007f5b095e3907 in QMimeData::hasText (this=this@entry=0x563cc0d96d20) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qmimedata.cpp:408
#6  0x00007f5aba1a98ac in Klipper::checkClipData (this=0x7f5a1401be80, selectionMode=<optimized out>) at /usr/src/debug/plasma-workspace-6.0.4-1.fc40.x86_64/klipper/klipper.cpp:785
#7  0x00007f5b095fa3f4 in QtPrivate::QSlotObjectBase::call (this=0x563cc0d0e2f0, r=<optimized out>, a=0x7ffc279288e0) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qobjectdefs_impl.h:469
#8  doActivate<false> (sender=0x563cc0d0d390, signal_index=3, argv=0x7ffc279288e0) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qobject.cpp:4078
#9  0x00007f5b095f09a7 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7f5b08db3a00 <KSystemClipboard::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffc279288e0) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qobject.cpp:4138
#10 0x00007f5b08d8f0b0 in KSystemClipboard::changed (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/kf6-kguiaddons-6.1.0-2.fc40.x86_64/redhat-linux-build/src/KF6GuiAddons_autogen/include/moc_ksystemclipboard.cpp:142
#11 0x00007f5b095fa3f4 in QtPrivate::QSlotObjectBase::call (this=0x563cc0d0e8f0, r=<optimized out>, a=0x7ffc27928998) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qobjectdefs_impl.h:469
#12 doActivate<false> (sender=0x563cc0ce79e0, signal_index=3, argv=0x7ffc27928998) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qobject.cpp:4078
#13 0x00007f5b09ab5056 in ffi_call_unix64 () at ../src/x86/unix64.S:104
#14 0x00007f5b09ab16a0 in ffi_call_int (cif=cif@entry=0x7ffc27928bb0, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=closure@entry=0x0) at ../src/x86/ffi64.c:673
#15 0x00007f5b09ab44ee in ffi_call (cif=cif@entry=0x7ffc27928bb0, fn=<optimized out>, rvalue=rvalue@entry=0x0, avalue=avalue@entry=0x7ffc27928c80) at ../src/x86/ffi64.c:710
#16 0x00007f5b0c41df2e in wl_closure_invoke (closure=closure@entry=0x7f5ae00035b0, target=<optimized out>, target@entry=0x563cc0d0dfe0, opcode=opcode@entry=1, data=<optimized out>, flags=1) at ../src/connection.c:1025
#17 0x00007f5b0c41e7a3 in dispatch_event (display=display@entry=0x563cbe2e2ac0, queue=0x563cbe2e2bb0) at ../src/wayland-client.c:1631
#18 0x00007f5b0c41ea4c in dispatch_queue (queue=0x563cbe2e2bb0, display=0x563cbe2e2ac0) at ../src/wayland-client.c:1777
#19 wl_display_dispatch_queue_pending (display=0x563cbe2e2ac0, queue=0x563cbe2e2bb0) at ../src/wayland-client.c:2019
#20 0x00007f5b0c076be2 in QtWaylandClient::QWaylandDisplay::flushRequests (this=<optimized out>) at /usr/src/debug/qt6-qtwayland-6.7.0-1.fc40.x86_64/src/client/qwaylanddisplay.cpp:227
#21 0x00007f5b095ebdd5 in QObject::event (this=0x563cbe2e2890, e=0x7f5ae0001430) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qobject.cpp:1446
#22 0x00007f5b0b98b368 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x563cbe2e2890, e=0x7f5ae0001430) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/widgets/kernel/qapplication.cpp:3287
#23 0x00007f5b09595ab8 in QCoreApplication::notifyInternal2 (receiver=0x563cbe2e2890, event=0x7f5ae0001430) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1134
#24 0x00007f5b09595d1d in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1575
#25 0x00007f5b09599861 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x563cbe2b1440) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1932
#26 0x00007f5b09599b0d in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1789
#27 0x00007f5b0987c7cf in postEventSourceDispatch (s=0x563cbe2df4b0) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:244
#28 0x00007f5b0826668c in g_main_dispatch (context=0x7f5af0000f00) at ../glib/gmain.c:3344
#29 g_main_context_dispatch_unlocked (context=0x7f5af0000f00) at ../glib/gmain.c:4152
#30 0x00007f5b082c7788 in g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7f5af0000f00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4217
#31 0x00007f5b08267b03 in g_main_context_iteration (context=0x7f5af0000f00, may_block=1) at ../glib/gmain.c:4282
#32 0x00007f5b0987bf83 in QEventDispatcherGlib::processEvents (this=0x563cbe2f4360, flags=...) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:394
#33 0x00007f5b095a26b3 in QEventLoop::exec (this=this@entry=0x7ffc279292c0, flags=..., flags@entry=...) at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/global/qflags.h:34
#34 0x00007f5b0959e63c in QCoreApplication::exec () at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/corelib/global/qflags.h:74
#35 0x00007f5b09dd518d in QGuiApplication::exec () at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/gui/kernel/qguiapplication.cpp:1926
#36 0x00007f5b0b98b2d9 in QApplication::exec () at /usr/src/debug/qt6-qtbase-6.7.0-3.fc40.x86_64/src/widgets/kernel/qapplication.cpp:2555
#37 0x0000563cbc51cea5 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/plasma-workspace-6.0.4-1.fc40.x86_64/shell/main.cpp:214
Comment 3 Nate Graham 2024-06-21 03:00:35 UTC
Any chance you could mention what you're using this script for?
Comment 4 Nate Graham 2024-06-25 14:29:58 UTC
Crashing here:

> auto qrCode = Prison::Barcode::create(Prison::QRCode);
> if (qrCode) {
>     if (item) {
>         qrCode->setData(item->text());          <<<<<<<<<<<<<<<<<< Here
>     }
>     BarcodeLabel *qrCodeLabel = new BarcodeLabel(std::move(*qrCode), mw);
>     layout->addWidget(qrCodeLabel);
> }
> 

Maybe item->text() is empty or nullptr and qrCode->setData() can't handle it?

Volker, I think you're familiar with this Prison code; any quick thoughts?
Comment 5 Kiril Vladimirov 2024-06-26 11:55:03 UTC
(In reply to Nate Graham from comment #3)
> Any chance you could mention what you're using this script for?

Honestly, no idea. Over time I got this habit to use wl-copy and wl-paste when something needs to be done over the span of a few commands (i.e. when i/o redirection is not feasible), instead of writing to throwaway files like /tmp/{a,b,c,...} or  piping tens of commands.

The issue was not that my script failed, as it makes sense to have an upper limit of the clipboard size, but that any other copy-paste operation, even via the UI in any application whatsoever, starting crashing my plasma shell. Could try to dig up the script in question, but it was NOT 100% reproducible for sure, because I remember that I've spent some fair amount of time, trying to find the tipping point of buffer size.
Comment 6 Nate Graham 2024-06-26 15:16:08 UTC
Plasma definitely shouldn't crash when this happens. I was just curious about what you were doing to trigger it. Because if it's a common use case, that would increase the priority to fix this.
Comment 7 Nate Graham 2024-07-22 20:23:30 UTC

*** This bug has been marked as a duplicate of bug 489096 ***