Bug 453562 - Plasma freezes in QXcbClipboard::waitForClipboardEvent() when saving an edited image
Summary: Plasma freezes in QXcbClipboard::waitForClipboardEvent() when saving an edite...
Status: RESOLVED DUPLICATE of bug 446581
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard (show other bugs)
Version: 5.24.3
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-09 07:08 UTC by Ralf Jung
Modified: 2022-06-07 15:32 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
'thread apply all bt' when the freeze happens (42.65 KB, text/plain)
2022-06-07 02:25 UTC, Ralf Jung
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Jung 2022-05-09 07:08:34 UTC
SUMMARY
When I sort and edit images I took, I usually have them in a folder on my Desktop. I go over them in Gwenview, and open some of them in Gimp for editing. When I save the image in Gimp and then immediately click the taskbar entry for Gwenview, nothing happens -- Plasma is entirely locked up for a few seconds before it goes back to being responsive. Hitting Alt-Tab to switch back to Gwenview works immediately.


STEPS TO REPRODUCE
1. Have a folder on your Desktop (not sure if that part is important) open in Dolphin, and open an image inside that folder with Gwenview.
2. From Gwenview, open Gimp. Edit the image a bit, and hit Ctrl-Shift-E to save it again.
3. Then immediately click on the Gwenview entry in the panel.

OBSERVED RESULT
Nothing happens for a few seconds -- not the usual hover effect when moving the mouse over the panel, and no window switching. Then after a bit, Gwenview is brought to the front.

EXPECTED RESULT
Plasma should be responsive as usual. Freezing the desktop shell for a few seconds is a bug.

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.16.0-5-amd64 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Xeon® CPU E3-1505M v5 @ 2.80GHz
Memory: 31,2 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics P530
Comment 1 Marco Martin 2022-05-09 13:21:08 UTC
may be interesting attaching gdb to plasmashell when the freeze happens to see where it was at the moment of the freeze
Comment 2 Ralf Jung 2022-05-09 13:27:08 UTC
So how would that go, roughly? Does the following sound right?

- attach gdb to plasmashell
- trigger the freeze
- quickly switch to the gdb console, Ctrl-C, catch a backtrace
Comment 3 Nate Graham 2022-05-09 16:16:01 UTC
Yep!
Comment 4 Bug Janitor Service 2022-05-24 04:35:51 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Ralf Jung 2022-06-07 02:25:19 UTC
Okay I think I got a setup that reproduces the problem, and I *think* I captured the right backtrace -- I will add the 'thread apply all bt' as an attachment, but here's the main thread:

Thread 1 (Thread 0x7f0dfd3f29c0 (LWP 814183) "plasmashell"):
#0  0x00007f0e019ef0fa in __futex_abstimed_wait_common64 (futex_word=futex_word@entry=0x5565f3675130, expected=expected@entry=0, clockid=clockid@entry=1, abstime=abstime@entry=0x7ffeb44b54e0, private=private@entry=0, cancel=cancel@entry=true) at ../sysdeps/nptl/futex-internal.c:74
#1  0x00007f0e019ef15b in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x5565f3675130, expected=expected@entry=0, clockid=clockid@entry=1, abstime=abstime@entry=0x7ffeb44b54e0, private=private@entry=0) at ../sysdeps/nptl/futex-internal.c:123
#2  0x00007f0e019e8f44 in __pthread_cond_wait_common (abstime=0x7ffeb44b54e0, clockid=1, mutex=0x5565f36750e0, cond=0x5565f3675108) at pthread_cond_wait.c:504
#3  __pthread_cond_timedwait (cond=0x5565f3675108, mutex=0x5565f36750e0, abstime=0x7ffeb44b54e0) at pthread_cond_wait.c:637
#4  0x00007f0e020657a8 in QWaitConditionPrivate::wait_relative(QDeadlineTimer) (deadline=..., this=0x5565f36750e0) at thread/qwaitcondition_unix.cpp:136
--Type <RET> for more, q to quit, c to continue without paging--
#5  QWaitConditionPrivate::wait(QDeadlineTimer) (deadline=..., deadline=..., this=0x5565f36750e0) at thread/qwaitcondition_unix.cpp:144
#6  QWaitCondition::wait(QMutex*, QDeadlineTimer) (this=<optimized out>, mutex=0x5565f3658928, deadline=...) at thread/qwaitcondition_unix.cpp:225
#7  0x00007f0e020658a7 in QWaitCondition::wait(QMutex*, unsigned long) (this=0x5565f3658930, mutex=0x5565f3658928, time=<optimized out>) at thread/qwaitcondition_unix.cpp:209
#8  0x00007f0dfcf7e673 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#9  0x00007f0dfcf53a60 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#10 0x00007f0dfcf54149 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#11 0x00007f0dfcf55b68 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#12 0x00007f0e0263f6bf in QInternalMimeData::formats() const () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#13 0x00007f0d8365040b in  () at /usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/dataengine/plasma_engine_clipboard.so
#14 0x00007f0e0227a133 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffeb44b5900, r=0x5565f5b8e490, this=0x7f0df8006f20) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#15 doActivate<false>(QObject*, int, void**) (sender=0x7f0df8008750, signal_index=3, argv=0x7ffeb44b5900) at kernel/qobject.cpp:3886
#16 0x00007f0e013157ee in KSystemClipboard::changed(QClipboard::Mode) () at /usr/lib/x86_64-linux-gnu/libKF5GuiAddons.so.5
#17 0x00007f0e0227a133 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffeb44b5a10, r=0x7f0df8008750, this=0x5565f5ba3fa0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#18 doActivate<false>(QObject*, int, void**) (sender=0x5565f3ea9ad0, signal_index=3, argv=0x7ffeb44b5a10) at kernel/qobject.cpp:3886
#19 0x00007f0e02a8face in QClipboard::changed(QClipboard::Mode) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#20 0x00007f0dfcf57c74 in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#21 0x00007f0dfcf59186 in QXcbConnection::processXcbEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#22 0x00007f0dfcf7f573 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#23 0x00007f0e001eff8b in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007f0e001f0238 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007f0e001f02ef in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007f0e0229b104 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5565f3723830, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#27 0x00007f0e022424db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffeb44b5cd0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#28 0x00007f0e0224a7b0 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#29 0x00005565f1ffa76a in  ()
#30 0x00007f0e01bc37fd in __libc_start_main (main=0x5565f1ff9910, argc=1, argv=0x7ffeb44b5f68, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffeb44b5f58) at ../csu/libc-start.c:332
#31 0x00005565f1ffa88a in  ()

I am not surprised to see the clipboard show up there, the clipboard has caused freezes in Plasma for me for at least the last 10 years across four different laptops.
Comment 6 Ralf Jung 2022-06-07 02:25:43 UTC
Created attachment 149516 [details]
'thread apply all bt' when the freeze happens
Comment 7 Ralf Jung 2022-06-07 02:28:39 UTC
Here's a main thread backtrace with some more debug symbols installed:

(gdb) bt
#0  0x00007f0e019ef0fa in __futex_abstimed_wait_common64
    (futex_word=futex_word@entry=0x5565f3675134, expected=expected@entry=0, clockid=clockid@entry=1, abstime=abstime@entry=0x7ffeb44b54e0, private=private@entry=0, cancel=cancel@entry=true) at ../sysdeps/nptl/futex-internal.c:74
#1  0x00007f0e019ef15b in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x5565f3675134, expected=expected@entry=0, clockid=clockid@entry=1, abstime=abstime@entry=0x7ffeb44b54e0, private=private@entry=0)
    at ../sysdeps/nptl/futex-internal.c:123
#2  0x00007f0e019e8f44 in __pthread_cond_wait_common (abstime=0x7ffeb44b54e0, clockid=1, mutex=0x5565f36750e0, cond=0x5565f3675108) at pthread_cond_wait.c:504
#3  __pthread_cond_timedwait (cond=0x5565f3675108, mutex=0x5565f36750e0, abstime=0x7ffeb44b54e0) at pthread_cond_wait.c:637
#4  0x00007f0e020657a8 in QWaitConditionPrivate::wait_relative(QDeadlineTimer) (deadline=..., this=0x5565f36750e0) at thread/qwaitcondition_unix.cpp:136
#5  QWaitConditionPrivate::wait(QDeadlineTimer) (deadline=..., deadline=..., this=0x5565f36750e0) at thread/qwaitcondition_unix.cpp:144
#6  QWaitCondition::wait(QMutex*, QDeadlineTimer) (this=<optimized out>, mutex=0x5565f3658928, deadline=...) at thread/qwaitcondition_unix.cpp:225
#7  0x00007f0e020658a7 in QWaitCondition::wait(QMutex*, unsigned long) (this=0x5565f3658930, mutex=0x5565f3658928, time=<optimized out>) at thread/qwaitcondition_unix.cpp:209
#8  0x00007f0dfcf7e673 in QXcbEventQueue::waitForNewEvents(unsigned long) (this=this@entry=0x5565f36588c0, time=163) at ./src/plugins/platforms/xcb/qxcbeventqueue.cpp:360
#9  0x00007f0dfcf53a60 in QXcbClipboard::waitForClipboardEvent(unsigned int, int, bool) (this=this@entry=0x5565f36fc3b0, window=window@entry=41943085, type=type@entry=31, checkManager=checkManager@entry=false)
    at ./src/plugins/platforms/xcb/qxcbclipboard.cpp:809
#10 0x00007f0dfcf54149 in QXcbClipboard::getSelection(unsigned int, unsigned int, unsigned int, unsigned int) (this=0x5565f36fc3b0, selection=1, target=380, property=385, time=286955112, time@entry=0)
    at ./src/plugins/platforms/xcb/qxcbclipboard.cpp:900
#11 0x00007f0dfcf55b68 in QXcbClipboard::getDataInFormat(unsigned int, unsigned int) (fmtAtom=<optimized out>, modeAtom=<optimized out>, this=<optimized out>) at ./qxcbatom.h:249
#12 QXcbClipboardMime::formats_sys() const (this=0x5565f5cfd060) at ./src/plugins/platforms/xcb/qxcbclipboard.cpp:100
#13 0x00007f0e0263f6bf in QInternalMimeData::formats() const (this=<optimized out>) at kernel/qinternalmimedata.cpp:98
#14 0x00007f0d836505fd in  () at /usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/dataengine/plasma_engine_clipboard.so
#15 0x00007f0e0227a133 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffeb44b5900, r=0x5565f5b8e490, this=0x7f0df8006f20) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#16 doActivate<false>(QObject*, int, void**) (sender=0x7f0df8008750, signal_index=3, argv=0x7ffeb44b5900) at kernel/qobject.cpp:3886
#17 0x00007f0e013157ee in KSystemClipboard::changed(QClipboard::Mode) () at /usr/lib/x86_64-linux-gnu/libKF5GuiAddons.so.5
#18 0x00007f0e0227a133 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffeb44b5a10, r=0x7f0df8008750, this=0x5565f5ba3fa0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#19 doActivate<false>(QObject*, int, void**) (sender=0x5565f3ea9ad0, signal_index=3, argv=0x7ffeb44b5a10) at kernel/qobject.cpp:3886
#20 0x00007f0e022735ff in QMetaObject::activate(QObject*, QMetaObject const*, int, void**)
    (sender=<optimized out>, m=m@entry=0x7f0e02ba1c20 <QClipboard::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffeb44b5a10) at kernel/qobject.cpp:3946
#21 0x00007f0e02a8face in QClipboard::changed(QClipboard::Mode) (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qclipboard.cpp:168
#22 0x00007f0e0263016b in QClipboard::emitChanged(QClipboard::Mode) (this=<optimized out>, mode=<optimized out>) at kernel/qclipboard.cpp:608
#23 0x00007f0e026121e3 in QPlatformClipboard::emitChanged(QClipboard::Mode) (this=<optimized out>, mode=<optimized out>) at kernel/qplatformclipboard.cpp:125
#24 0x00007f0dfcf543a6 in QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_event_t*) (this=<optimized out>, event=event@entry=0x7f0df801a460) at ./src/plugins/platforms/xcb/qxcbclipboard.cpp:679
#25 0x00007f0dfcf57c74 in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) (this=this@entry=0x5565f365c420, event=event@entry=0x7f0df801a460) at ./src/plugins/platforms/xcb/qxcbconnection.cpp:685
#26 0x00007f0dfcf59186 in QXcbConnection::processXcbEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5565f365c420, flags=...) at ./src/plugins/platforms/xcb/qxcbconnection.cpp:1003
#27 0x00007f0dfcf7f573 in xcbSourceDispatch(GSource*, GSourceFunc, gpointer) (source=<optimized out>) at ./src/plugins/platforms/xcb/qxcbeventdispatcher.cpp:103
#28 0x00007f0e001eff8b in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007f0e001f0238 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007f0e001f02ef in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007f0e0229b104 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5565f3723830, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#32 0x00007f0e022424db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffeb44b5cd0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#33 0x00007f0e0224a7b0 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#34 0x00005565f1ffa76a in  ()
#35 0x00007f0e01bc37fd in __libc_start_main (main=0x5565f1ff9910, argc=1, argv=0x7ffeb44b5f68, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffeb44b5f58) at ../csu/libc-start.c:332
#36 0x00005565f1ffa88a in  ()

"waitForClipboardEvent" does quite sound like a blocking call in the main UI thread.
Comment 8 Nate Graham 2022-06-07 15:27:19 UTC
Thanks for that information, it seems very helpful.
Comment 9 Fushan Wen 2022-06-07 15:32:02 UTC

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