-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wl-paste hangs when pasting text from a closed XWayland application #185
Comments
Hello and thanks for the clear report!
(Please don't ever add important information in an edit 🙁 People who are subscribed to the issue, myself included, do not get notified when you edit your posts, new emails don't get sent, etc. I happened to see the edit, but I could have just as easily missed it. Edits are for fixing typos, not for adding new content.) The reason KWrite doesn't hang is likely that it uses asynchronous I/O to receive clipboard contents without blocking the main thread. This very much makes sense for a GUI app, it must do that to keep the UI responsive while transferring the data.
The real bug here is not the wl-clipboard hangs, but that the data that wl-clipboard waits for never comes. This must either be the Klipper bug you've linked to, or perhaps something in KWin and XWayland integration. In the issue report you've linked to, KDE developers were unable to reproduce the bug, perhaps you could help them with that? |
I disagree, the help for
So it should either paste the content, or fail if it can't do that, not hang forever. What does it wait for here? Copying a valid content to the clipboard does not wake it up.
In this comment https://bugs.kde.org/show_bug.cgi?id=449909#c13, Nate Graham, which I assume is a developer was able to reproduce it. But I fear the bug does not have a very high priority from KDE's perspective, you can easily select the entry from Klipper to make it valid and paste it again. With |
I disabled I furthermore, found out that pasting in |
Well, I'm sure help for
I think I might understand why you're thinking of it this way. If the Wayland clipboard was just a "place" maintained by the compositor where you could put things into (copy) and get things from (paste), and wl-clipboard would indeed just wait for who-knows-what in this weird case, then it'd be appropriate to call it a hang, and indeed, why would wl-clipboard even do that, why wouldn't it just report an error and exit if it cannot paste. Is that what you thinking? But that's not how clipboard works in Wayland (nor in X11). Clipboard is not a place, it's the interaction between the two clients (apps), the one who has copied the data and the one that's pasting. When you copy (with Ctrl-C, or with
To reiterate: you cannot "just get" the clipboard contents, you have to wait for the other client to transfer them to you. That's just how it works. It only makes sense that
That's because it's still trying to paste from the old client. By that point
Ah, I see, great. Yes, Nate is a KDE developer.
I imagine you could just interrupt
As I said, the other applications likely "deal with it" by doing the data transfer in parallel (or rather, concurrently) with continuing to update the UI, reacting to mouse events, etc. If you peek under the hood, you should see that the data transfer (the attempt to paste) is still ongoing. (Perhaps they also have a way to cancel the transfer, either on timeout or if new a new data offer appears.)
The relevant code in KWin seems to be |
Two more things:
|
wl-paste
and observe that it hangsThis happens 100% of the time, but only when pasting from XWayland applications.
This is probably a more general problem, since
wl-clipboard-rs
also has the same problem. But it's basically a showstopper for me sincewl-clipboard
is used by Neovim and causes Neovim to hang as well.Pasting into other applications like KWrite does not paste anything either, but it also doesn't hang. The text is still in the Klipper history, and can be selected, and then pasting works again.
running
WAYLAND_DEBUG=1 wl-paste
gives the followingMy specs
Arch Linux
wl-clipboard 2.1.0
KDE Plasma 5.27.6
xorg-xwayland 23.1.2-1
NOTE: This is probably closely related to #149
Edit: The root cause is this Klipper bug https://bugs.kde.org/show_bug.cgi?id=449909. But still, wl-paste should not hang.
The text was updated successfully, but these errors were encountered: