Bug 393804

Summary: Clipboard freezes when KVM/QEMU VM window is opened using virt-manager
Product: [Plasma] plasmashell Reporter: Adam Ruckel <ad.ruckel>
Component: ClipboardAssignee: Plasma Bugs List <plasma-bugs>
Status: CONFIRMED ---    
Severity: normal CC: ad.ruckel, aleixpol, Landgraf132, nate, peter.eszlari, plasma-bugs, sitter, tagwerk19, valdikss
Priority: NOR    
Version: 5.11.0   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
URL: https://bugreports.qt.io/browse/QTBUG-67822
Latest Commit: Version Fixed In:

Description Adam Ruckel 2018-05-03 14:49:48 UTC
Recently I powered on older laptop with Fedora 26 with KDE Plasma that hasn’t been updated for some time. After update I quickly realized that there is something wrong with clipboard.
 
On F26 without updates I was used to open multiple local KVM/QEMU VMs via virt-manager and for example one or two VMs on remote host over LAN and everything worked well - Windows VMs with installed Spice drivers and Fedora 26 VMs that have spice-vdagent installed by default. Copy & pasting text between VMs or just within host worked just fine.
 
Then I updated F26 host. Clipboard worked just fine until I opened some VM windows. After that clipboard freezes time to time when pasting. Sometime pasting just don’t work and sometime when you press Ctrl + V all keyboard inputs freeze and keyboard simple stop working for a couple of seconds. The only workaround is to close VM windows or wait.
 
This is extremely irritating since you never know if Paste will or won’t work. I also tested this issue on F27 and F28 and KDE Neon which tells me that this is not a problem of Fedora implementation. This issue is less annoying on newer versions of Plasma (5.12) where it does not lock input – pasting just don’t work.
 
Everything is OK for:
Fedora
# plasma-*-5.10.5
# kf5-*-5.35.0 / 17.04.1
# qt5-*-5.7.1

and Debian
# plasma-*-5.8.6

This tells me that the bug was introduced in 5.10.5 or later.
 
Steps to Reproduce:
1. Install F26 KDE Plasma, do not update
2. Run multiple VMs, some with F26 KDE Plasma, some with Windows with Spice drivers
3. Open virt-manager VM windows
4. Copy and paste in host inside for example Kate or between host and VM – everything works just fine
5. Update F26 host
6. Again copy/cut and paste – paste sometime won’t work and sometime it will also freeze keyboard for a couple of seconds
7. Close VM windows
8. Everything is OK again

Thank you for you great work! I do love Plasma ;-)

Kind regards,
Adam
Comment 1 Adam Ruckel 2018-05-08 08:59:21 UTC
"plasmashell --version" command on Debian gets:
plasmashell 5.8.6

and on Fedora:
plasmashell 5.10.1

so the bug was introduced probably in 5.10.[6-9]. I'm not sure about 5.10.5 since "rpm -qa" gets "5.10.5" on Fedora
Comment 2 Peter Eszlari 2018-05-15 23:16:46 UTC
I'm seeing this bug too - running Ubuntu 18.04 in virt-manager on Kubuntu 18.04.
Comment 3 Harald Sitter 2018-05-16 11:12:31 UTC
I can reproduce this on neon with Plasma 5.12.5 (+ Qt 5.10 + Ubuntu 16.04 base) for the host and Plasma master (+ Qt 5.10 + Ubuntu 18.04 base) as guest in the VM.

A couple of observations:

Doesn't happen if you disable clipboard sync (e.g. `virt-xml neonUnstableBionic --update --edit --graphics spice,listen=127.0.0.1,port=5900,clipboard_copypaste=no`)

The freeze also doesn't happen when you leave clipboard sync enabled but disable the host klipper (e.g. remove the systray applet). Kinda expected but I thought I'd point it out. To the same end disabling the guest klipper does the same, albeit even more obvious since it freezes in the code you'd disable xD. 

Disabling the `newClipData`/`slotCheckPending` function of klipper on the host also seems to prevent the freeze, not sure what that tells us other than the host doing something which then prompts the freeze in the guest.

The guest Plasma doesn't always freeze, sometimes it doesn't for a dozen copies, sometimes it does after only a couple. What then seems to happen is it hitting a timeout as after numerous seconds it will unfreeze again.

For my host the plasma never freezes, it does however sometimes seem to "lose" a paste. Say I am in konsole, copy something, then go to firefox and paste it, nothing pastes and the klipper history has an empty entry. I am not entirely sure this is related, but it certainly seems to only happen when I also have a Plasma VM running.

The last two points particularly make me think that this is maybe a race condition between the two klippers. Why one freezes and the other doesn't is somewhat beyond me though. Might also be a loop between the two, but then I'd expect more consistent freezing on both ends.

Backtrace of the Guest Plasma (the frozen one).

Thread 10 (Thread 0x7f80ad06b700 (LWP 4875)):
#0  0x00007f8191320ed9 in futex_reltimed_wait_cancelable (private=<optimized out>, reltime=0x7f80ad06ac00, expected=0, 
    futex_word=0x55c4889fc5a0) at ../sysdeps/unix/sysv/linux/futex-internal.h:142
#1  __pthread_cond_wait_common (abstime=0x7f80ad06acc0, mutex=0x55c4889fc550, cond=0x55c4889fc578) at pthread_cond_wait.c:533
#2  __pthread_cond_timedwait (cond=0x55c4889fc578, mutex=0x55c4889fc550, abstime=0x7f80ad06acc0) at pthread_cond_wait.c:667
#3  0x00007f81921a2eb8 in QWaitConditionPrivate::wait_relative (time=30000, this=0x55c4889fc550) at thread/qwaitcondition_unix.cpp:133
#4  QWaitConditionPrivate::wait (time=30000, this=0x55c4889fc550) at thread/qwaitcondition_unix.cpp:141
#5  QWaitCondition::wait (this=this@entry=0x55c48864d140, mutex=mutex@entry=0x55c48863ceb0, time=30000) at thread/qwaitcondition_unix.cpp:215
#6  0x00007f819219eefd in QThreadPoolThread::run (this=0x55c48864d130) at thread/qthreadpool.cpp:146
#7  0x00007f81921a1b8f in QThreadPrivate::start (arg=0x55c48864d130) at thread/qthread_unix.cpp:376
#8  0x00007f819131a6db in start_thread (arg=0x7f80ad06b700) at pthread_create.c:463
#9  0x00007f8191a9488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 9 (Thread 0x7f80c0d2c700 (LWP 4857)):
#0  0x00007f8191a87bf9 in __GI___poll (fds=0x7f80bc006470, nfds=1, timeout=3500478) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f818b8b0439 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f818b8b054c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f81923e2c9f in QEventDispatcherGlib::processEvents (this=0x7f80bc000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#4  0x00007f819238673a in QEventLoop::exec (this=this@entry=0x7f80c0d2bd20, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
#5  0x00007f819219c82a in QThread::exec (this=<optimized out>) at thread/qthread.cpp:522
#6  0x00007f80c368a067 in KCupsConnection::run() () from /usr/lib/x86_64-linux-gnu/libkcupslib.so
#7  0x00007f81921a1b8f in QThreadPrivate::start (arg=0x55c4871a6930) at thread/qthread_unix.cpp:376
#8  0x00007f819131a6db in start_thread (arg=0x7f80c0d2c700) at pthread_create.c:463
#9  0x00007f8191a9488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 8 (Thread 0x7f80d689f700 (LWP 4847)):
#0  0x00007f8191a87bf9 in __GI___poll (fds=0x7f80d0005220, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f818b8b0439 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f818b8b054c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f81923e2c9f in QEventDispatcherGlib::processEvents (this=0x7f80d0000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#4  0x00007f819238673a in QEventLoop::exec (this=this@entry=0x7f80d689ecf0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
#5  0x00007f819219c82a in QThread::exec (this=<optimized out>) at thread/qthread.cpp:522
#6  0x00007f8196123c36 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5
#7  0x00007f81921a1b8f in QThreadPrivate::start (arg=0x55c485db9fc0) at thread/qthread_unix.cpp:376
#8  0x00007f819131a6db in start_thread (arg=0x7f80d689f700) at pthread_create.c:463
#9  0x00007f8191a9488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 7 (Thread 0x7f80e7d62700 (LWP 4832)):
#0  0x00007f81913209f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55c485b94538)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x55c485b944e8, cond=0x55c485b94510) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x55c485b94510, mutex=0x55c485b944e8) at pthread_cond_wait.c:655
#3  0x00007f81716ce86b in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#4  0x00007f81716ce6e7 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#5  0x00007f819131a6db in start_thread (arg=0x7f80e7d62700) at pthread_create.c:463
#6  0x00007f8191a9488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 6 (Thread 0x7f80e8563700 (LWP 4831)):
#0  0x00007f81913209f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55c485b943d0)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x55c485b94380, cond=0x55c485b943a8) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x55c485b943a8, mutex=0x55c485b94380) at pthread_cond_wait.c:655
#3  0x00007f81716ce86b in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#4  0x00007f81716ce6e7 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#5  0x00007f819131a6db in start_thread (arg=0x7f80e8563700) at pthread_create.c:463
#6  0x00007f8191a9488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7f81739db700 (LWP 4825)):
#0  0x00007f81913209f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8198336fb8)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x7f8198336f68, cond=0x7f8198336f90) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x7f8198336f90, mutex=0x7f8198336f68) at pthread_cond_wait.c:655
#3  0x00007f8198041904 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Script.so.5
#4  0x00007f8198041949 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Script.so.5
#5  0x00007f819131a6db in start_thread (arg=0x7f81739db700) at pthread_create.c:463
#6  0x00007f8191a9488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7f817a122700 (LWP 4815)):
#0  0x00007f8191a87bf9 in __GI___poll (fds=0x7f816c004a00, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f818b8b0439 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f818b8b054c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f81923e2c9f in QEventDispatcherGlib::processEvents (this=0x7f816c000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#4  0x00007f819238673a in QEventLoop::exec (this=this@entry=0x7f817a121d40, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
#5  0x00007f819219c82a in QThread::exec (this=<optimized out>) at thread/qthread.cpp:522
#6  0x00007f8195cd17d5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#7  0x00007f81921a1b8f in QThreadPrivate::start (arg=0x55c48594cd80) at thread/qthread_unix.cpp:376
#8  0x00007f819131a6db in start_thread (arg=0x7f817a122700) at pthread_create.c:463
#9  0x00007f8191a9488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7f817bb67700 (LWP 4799)):
#0  0x00007f8191a87bf9 in __GI___poll (fds=0x7f8174012790, nfds=4, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f818b8b0439 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f818b8b054c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f81923e2c9f in QEventDispatcherGlib::processEvents (this=0x7f8174000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#4  0x00007f819238673a in QEventLoop::exec (this=this@entry=0x7f817bb66d30, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
#5  0x00007f819219c82a in QThread::exec (this=<optimized out>) at thread/qthread.cpp:522
#6  0x00007f819469ddf5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#7  0x00007f81921a1b8f in QThreadPrivate::start (arg=0x7f8194910d60) at thread/qthread_unix.cpp:376
#8  0x00007f819131a6db in start_thread (arg=0x7f817bb67700) at pthread_create.c:463
#9  0x00007f8191a9488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f8181f43700 (LWP 4757)):
#0  0x00007f8191a87bf9 in __GI___poll (fds=0x7f8181f42c68, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f8196d4e747 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007f8196d5036a in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007f81844c3aa9 in QXcbEventReader::run (this=0x55c4858894b0) at qxcbconnection.cpp:1370
#4  0x00007f81921a1b8f in QThreadPrivate::start (arg=0x55c4858894b0) at thread/qthread_unix.cpp:376
#5  0x00007f819131a6db in start_thread (arg=0x7f8181f43700) at pthread_create.c:463
#6  0x00007f8191a9488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f819898c480 (LWP 4746)):
#0  0x00007f8191a8a03f in __GI___select (nfds=nfds@entry=0, readfds=readfds@entry=0x0, writefds=writefds@entry=0x0, 
    exceptfds=exceptfds@entry=0x0, timeout=timeout@entry=0x7ffe055c8a50) at ../sysdeps/unix/sysv/linux/select.c:41
#1  0x00007f81844bd682 in QXcbClipboard::waitForClipboardEvent (this=this@entry=0x55c4858980a0, win=win@entry=39845970, type=type@entry=31, 
    timeout=timeout@entry=5000, checkManager=checkManager@entry=false) at qxcbclipboard.cpp:905
#2  0x00007f81844bdcff in QXcbClipboard::getSelection (this=0x55c4858980a0, selection=1, target=target@entry=368, property=308, time=1559900, 
    time@entry=0) at qxcbclipboard.cpp:993
#3  0x00007f81844bfdef in QXcbClipboard::getDataInFormat (fmtAtom=368, modeAtom=<optimized out>, this=<optimized out>)
    at qxcbclipboard.cpp:978
#4  QXcbClipboardMime::retrieveData_sys (this=0x7f817c0016c0, fmt=..., requestedType=QVariant::String) at qxcbclipboard.cpp:149
#5  0x00007f81929072a6 in QInternalMimeData::retrieveData (this=0x7f817c0016c0, mimeType=..., type=QVariant::String) at kernel/qdnd.cpp:214
#6  0x00007f81923b0880 in QMimeDataPrivate::retrieveTypedData (this=0x55c488d03830, format=..., type=QVariant::String)
    at kernel/qmimedata.cpp:112
#7  0x00007f81923b1855 in QMimeData::text (this=this@entry=0x7f817c0016c0) at kernel/qmimedata.cpp:400
#8  0x00007f80c5f208e0 in HistoryItem::create (data=data@entry=0x7f817c0016c0) at ./klipper/historyitem.cpp:60
#9  0x00007f80c5f0c3d0 in Klipper::applyClipChanges (this=this@entry=0x55c486d12640, clipData=clipData@entry=0x7f817c0016c0)
    at ./klipper/klipper.cpp:609
#10 0x00007f80c5f0e6c8 in Klipper::checkClipData (this=0x55c486d12640, selectionMode=<optimized out>) at ./klipper/klipper.cpp:743
#11 0x00007f81923b7d4f in QtPrivate::QSlotObjectBase::call (a=0x7ffe055c9050, r=0x55c486d12640, this=0x55c486d23390)
    at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:378
#12 QMetaObject::activate (sender=0x55c485e9d690, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, 
    argv=argv@entry=0x7ffe055c9050) at kernel/qobject.cpp:3749
#13 0x00007f81923b8307 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7f8192f7b4e0 <QClipboard::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffe055c9050) at kernel/qobject.cpp:3628
#14 0x00007f8192ca012e in QClipboard::changed (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qclipboard.cpp:163
#15 0x00007f81928e4663 in QPlatformClipboard::emitChanged (this=this@entry=0x55c4858980a0, mode=mode@entry=QClipboard::Selection)
    at kernel/qplatformclipboard.cpp:125
#16 0x00007f81844bdf45 in QXcbClipboard::handleXFixesSelectionRequest (this=0x55c4858980a0, event=event@entry=0x7f817c00b1b0)
    at qxcbclipboard.cpp:737
#17 0x00007f81844c5753 in QXcbConnection::handleXcbEvent (this=this@entry=0x55c485879100, event=event@entry=0x7f817c00b1b0)
    at qxcbconnection.cpp:1181
#18 0x00007f81844c625c in QXcbConnection::processXcbEvents (this=0x55c485879100) at qxcbconnection.cpp:1767
#19 0x00007f81923b87a2 in QObject::event (this=0x55c485879100, e=<optimized out>) at kernel/qobject.cpp:1246
#20 0x00007f81939b45cc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007f81939bbd84 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007f81923884f8 in QCoreApplication::notifyInternal2 (receiver=0x55c485879100, event=event@entry=0x7f817c00e220)
    at kernel/qcoreapplication.cpp:1044
#23 0x00007f819238b08d in QCoreApplication::sendEvent (event=0x7f817c00e220, receiver=<optimized out>)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:234
#24 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x55c48585f430)
    at kernel/qcoreapplication.cpp:1719
#25 0x00007f819238b618 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0)
    at kernel/qcoreapplication.cpp:1573
#26 0x00007f81923e3673 in postEventSourceDispatch (s=0x55c4858c0340) at kernel/qeventdispatcher_glib.cpp:276
#27 0x00007f818b8b0287 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007f818b8b04c0 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007f818b8b054c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007f81923e2c9f in QEventDispatcherGlib::processEvents (this=0x55c4858b8b80, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#31 0x00007f8184547fc1 in QPAEventDispatcherGlib::processEvents (this=0x55c4858b8b80, flags=...) at qeventdispatcher_glib.cpp:69
#32 0x00007f819238673a in QEventLoop::exec (this=this@entry=0x7ffe055c9710, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
#33 0x00007f819238f974 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1332
#34 0x000055c48482aa78 in main (argc=<optimized out>, argv=<optimized out>) at ./shell/main.cpp:212
Comment 4 Adam Ruckel 2018-05-18 15:08:07 UTC
I agree with @Harald and I need to add that the guest does NOT have to be Plasma. Single guest with Windows (and with updated Spice / Virtio drivers) is also a problem.

I tested to connect this Windows box remotely over SSH from old Plasma (no problems) and locally / remotely from the current Plasma (clip freezing issue).

Btw. I don't think that we're on Wayland so this must be some strange Host issue.
Comment 5 Adam Ruckel 2018-05-22 10:06:14 UTC
This is my first bug on KDE.org so I'm not sure what to do now. Do you want me to change status to CONFIRMED? Or is there anything else I can do to help?

Thank you
Comment 6 Christoph Feck 2018-06-15 21:40:16 UTC
If developers need more information, they will come back to you. If we find a developer able to fix this issue, then the bug status is automatically updated.
Comment 7 Aleix Pol 2020-03-31 17:58:24 UTC
I've looked into it, it looks like an issue in QXcbClipboard, which obviously doesn't help but we better say so.

It seems quite similar to this bug report here in Qt Creator (funny that Qt Creator people talk about Qt as upstream as well).
https://bugreports.qt.io/browse/QTBUG-67822?jql=text%20~%20%22waitForClipboardEvent%22

It could make sense to try and simplify the test case.
Or just try to make sense of qxcbclipboard.cpp.

What we have here is QXcbClipboard::getSelection blocking on QXcbClipboard::waitForClipboardEvent to get the requested selection. There's supposedly a 5s timeout which doesn't seem to arrive either.
Comment 8 Aleix Pol 2020-03-31 17:58:40 UTC
I've looked into it, it looks like an issue in QXcbClipboard, which obviously doesn't help but we better say so.

It seems quite similar to this bug report here in Qt Creator (funny that Qt Creator people talk about Qt as upstream as well).
https://bugreports.qt.io/browse/QTBUG-67822?jql=text%20~%20%22waitForClipboardEvent%22

It could make sense to try and simplify the test case.
Or just try to make sense of qxcbclipboard.cpp.

What we have here is QXcbClipboard::getSelection blocking on QXcbClipboard::waitForClipboardEvent to get the requested selection. There's supposedly a 5s timeout which doesn't seem to arrive either.
Comment 9 Nate Graham 2021-03-10 23:09:16 UTC
Seems like this issue is fully upstream in Qt. I would recommend following up there. Thanks for the thorough investigation, everyone!
Comment 10 Adam Ruckel 2021-04-02 19:14:19 UTC
Please don’t take it offensive but this bug should not be closed. I understand that this is a Qt issue but I’m a user, not a developer. If I open a bug in Qt bugzilla, I don’t know what to tell them. But I do know how to explain it here - from a perspective of a user.

I can confirm this is still an issue on the following systems that I used in last 3 months:

5.14 (Debian)
5.18 (Kubuntu 20.04)
5.19 (Kubuntu 20.10)
5.20 (Fedora 33)
5.21 (Arch)

Workaround:

Configure System Tray => Disable Clipboard.
Comment 11 valdikss 2021-08-24 10:24:16 UTC
I can confirm this issue. It also happens with other two-way-clipboard-sync applications like VirtualBox or FreeRDP.
Comment 12 tagwerk19 2022-01-27 09:04:53 UTC
(In reply to Adam Ruckel from comment #10)
> ... I can confirm this is still an issue on the following systems that I used in
> last 3 months ...
> 
> 5.20 (Fedora 33)
If the main symptom is "freezing when pasting" (when trying to copy between VM's), then
    https://bugs.kde.org/show_bug.cgi?id=417590#c19
seems related. I do still encounter this.