FreeRDP: Clipboard of FreeRDP frequently breaks clipboard content on host (X11)
Describe the bug I frequently experience issues with the local clipboard (copy/paste) not working properly on my machine (Linux Mint 20.1). In particular, copied content regularly (feels like once every 3-10 times maybe) cannot not be pasted (Ctrl-V) anymore, as if the clipboard content got lost - and in such cases, applications I’m trying to paste into will even freeze for some seconds before reacting again (and then, not actually pasting anything, as if the clipboard had been empty).
After some testing, I am able to clearly pin this to FreeRDP, which I have usually running on the machine, connected to a Windows 10 server. Note that I have the copy/paste issues also if neither of them is related to the FreeRDP session (i.e., copy/pasting from/to other applications I have running on my local machine).
If I stop the FreeRDP session, the problems are gone. Likewise, it’s also not a problem if I start the session with -clipboard.
I tried things with two versions:
- default from mint repos:
2.2.0 - recent nightly build
3.0.0-dev (892cbe326)
The symptoms are somewhat different between those versions (the “freeze” on paste only occurs with (1.) for me), but the general issue with “broken” clipboard content is present in both. Seems like some race condition to me.
To Reproduce That took me some time, since it’s not happening always / sometimes hard to pin down. Following steps are a bit artificial, but reproduce the issue very well for me now.
- Open a terminal and run following command (to observe the ‘content’ / types of clipboard content). Keep that terminal visible on the side, to observe what it displays.
watch -t -n0.1 xclip -o -selection "clipboard" -t TARGETS
- Open some other application to copy a piece of content in. I just use a simple text-editor (xed). Select a piece of text, press Ctrl+C and hold it for a few seconds (the holding is just to generate many keyboard events, which provokes the problem much more consistently)
- Observe the content of the terminal / xclip-watch, esp. after letting Ctrl+C go again after some seconds
Without FreeRDP running (or with -clipboard), the content shown by xclip will never change for me after the first copy (across all the copy-events). What’s shown depends on where we copy something from, for xed it usually looks like this for me:
TIMESTAMP
TARGETS
MULTIPLE
SAVE_TARGETS
GTK_TEXT_BUFFER_CONTENTS
application/x-gtk-text-buffer-rich-text
UTF8_STRING
COMPOUND_TEXT
TEXT
STRING
text/plain;charset=utf-8
text/plain
When running FreeRDP with clipboard, the shown content for me usually ends up at one of the following, when provoking the problem with many copy-events as explained above:
TIMESTAMP
TARGETS
UTF8_STRING
STRING
image/bmp
text/uri-list
x-special/gnome-copied-files
x-special/mate-copied-files
text/html
or
TIMESTAMP
TARGETS
UTF8_STRING
STRING
If the clipboard is in this state, its content seems broken; it is not possible to extract the real (copied) content anymore from it. An attempt to read the actual String-content via xclip leads to something like this:
$ xclip -o -selection "clipboard" -t STRING
Error: target STRING not available
So it seems that FreeRDP, in the process of capturing the copied content to also enable it for the RDP session, can also somehow break the clipboard content, probably caused by some race-condition. I can find some of the mime-types that are included in the “broken” xclip-output above (like image/bmp, text/uri-list, x-special/gnome-copied-files, x-special/mate-copied-files) also in the sources (client/X11/xf_cliprdr.c), though I don’t understand the code well enough to be able to pinpoint this further.
Expected behavior Copy/paste operations should not break the clipboard content.
Additional context The log-output sometimes also shows following logs, which sounds like in https://github.com/FreeRDP/FreeRDP/issues/5997. Not sure if there is some relation to that issue here.
[00:00:32:036] [2238136:2238232] [INFO][com.freerdp.client.x11] - skipping, empty data detected!!!
[00:00:33:023] [2238136:2238232] [INFO][com.freerdp.client.x11] - skipping, empty data detected!!!
[00:00:33:308] [2238136:2238232] [INFO][com.freerdp.client.x11] - skipping, empty data detected!!!
[00:00:34:771] [2238136:2238232] [INFO][com.freerdp.client.x11] - skipping, empty data detected!!!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 19 (6 by maintainers)
+1
Using Gentoo and FreeRDP 2.10.0-r3
If I close the RDP session or run it without clipboard support, problems go away.