Xpra: Ticket #703: Copying URL from web browser address bar on remote host fails

Copying and pasting generally works fine from and to web browsers on remote machines.

However, when I try to copy URL from address bar of the remote host, not only it does not register on the local clipboard, but also the clipboard integration is entirely disabled. clicking on tray menu shows previously checked clipboard unchecked, and re-checking it fails to re-enable clipboard copying between local and remote host. Only disconnecting and reconnecting restore clipboard. Selected URL can, however, be copied to remote web browser itself.

This problem appears in both firefox and chrome running on remote host.

The error message on the client window is:

"/usr/lib/python2.7/dist-packages/xpra/gtk_common/nested_main.py:163: Warning: Source ID 87638 was not found when attempting to remove it

Attached files show the information reported by bug report from tray menu

I'm running the latest xpra 0.14.8 on both server and client, the server running ubuntu 14.04 x86_64 and client running 14.04 32 bit.

Wed, 01 Oct 2014 20:59:29 GMT - Jiang: attachment set

Wed, 01 Oct 2014 21:11:34 GMT - Jiang:

This problem is present when trying to copy URL from context menu of a web browser as well. For example. right-clicking a link on firefox running on remote machine and then select from popup menu "copy URL" will not work and disable clipboard integration for the rest of the session

Wed, 01 Oct 2014 21:25:48 GMT - Jiang: attachment set

Thu, 02 Oct 2014 02:47:33 GMT - Antoine Martin: owner, description changed

That's odd, the clipboard got tested quite thoroughly. Normally when it gets disabled is because we detect a loop, when another application is also synchronizing it, and we end up disabling it. But I would have expected a message to show up.

Can you post the clipboard debug log? Run both the client and server with -d clipboard.

Thu, 02 Oct 2014 05:44:29 GMT - Jiang:

Yes, it did say something about the loop. For what it's worth, I'm running on my local ubuntu machine clipboard manager parcellite. But I don't think it is the problem, since I change the clipboard manager to glipper the problem persist. If you have a ubuntu trusty (14.04) machine, perhaps you could reproduce it? It's a major annoyance here, since the more often use of clipboard exchange between host and client is exchanging URLs...

Anyway, thanks for looking into this!

Here's the message from debugging

2014-10-02 01:40:12,150 loop nesting too deep: 11
2014-10-02 01:40:12,150 you may have a clipboard forwarding loop, disabling the clipboard
/usr/lib/python2.7/dist-packages/xpra/gtk_common/nested_main.py:162: Warning: Source ID 520 was not found when attempting to remove it
/usr/lib/python2.7/dist-packages/xpra/gtk_common/nested_main.py:162: Warning: Source ID 515 was not found when attempting to remove it

Thu, 02 Oct 2014 05:51:34 GMT - Antoine Martin: keywords changed; milestone set

This is covered in the FAQ: Please make sure that you are not running a clipboard manager which may interfere with xpra's clipboard synchronization code (ie: klipper is known to cause such problems).

Clipboard managers are known to cause serious problems. I guess what we could do is exit the nesting when we get a request for the clipboard contents whilst we are waiting for that request ourselves. But we would still be at the mercy of clipboard managers not doing crazy requests... and from past experience, that's a big assumption to make. Until then, it is best to not use clipboard managers.

Thu, 02 Oct 2014 06:55:38 GMT - Jiang:

Unfortunately, I killed all clipboard manager, killed the connection, and reconnected, and the problem persists.

Thu, 02 Oct 2014 07:18:31 GMT - Antoine Martin:

Then something else is syncing clipboards, vmware or virtualbox perhaps.

I have added the warning message to the FAQ: FAQ changes no 62

Thu, 02 Oct 2014 19:13:39 GMT - Jiang:

I'm not running any virtual machine. Is there any way to figure out which program is the problem?

Furthermore, this is peculiar, since I'm not having problem with copy and paste in general. Copying and pasting from webpages by selecting text works. The only problem is selecting URLs, either from address bar, or by context menus. And this is not just for web browsers. For example, if I run gnome-terminal and select URL by context menu, this bug shows up, too.

To further debug, I disabled gnome url-handler related configurations in gconf, and disabled any clipboard manager. But the problem persists.

Any suggestion to further debug this would be much appreciated. It may well has something to do with url handler in gnome or some other desktop environments. If so, it would be helpful for other users to find out this as well!

By the way, thank you for being so responsive! And xpra really rocks! I've been searching a good thin-client agent to use on my local LAN for a long time, and xpra really solved all my problems with NX, forward X, vnc, etc, and the performance is simply terrific!

Fri, 03 Oct 2014 03:40:28 GMT - Antoine Martin:

Is there any way to figure out which program is the problem?

Well, there is, but you're not going to like it: you have to stop every X11 program until you find the one that is causing the problem. Assuming that it isn't the browser itself. I guess you could start by running the browser under a minimal desktop like twm, and see if the problem still occurs.

The only problem is selecting URLs, either from address bar, or by context menus.

In a way, that's a good thing. I think at the very least we should be able to come up with a workaround.

Any suggestion to further debug this would be much appreciated.

You can run the client and server with -d clipboard and post the output.

(..) xpra really rocks! (..)


Fri, 03 Oct 2014 06:22:18 GMT - Jiang:

This got to be the single most bizarre bug I've ever seen! I followed your advice and installed openbox. The bug persists even in that very minimalist window manager(with no clipboard manager running, of course).

So it is a very persistent bug.

But then I have the strangest discovery. I began killing program I run one by one, to no avail.

Until I realize that it's my habit, as a commandline fanatic, to run 7-8 gnome-terminal instances. I found that I can only reproduce the bug when there are at least 5 gnome-terminal instances running. If I have 7-8 instances running, the bug is fairly consistently reproducible. (Sometimes the copying URL problem does not appear on the first session. the copy and paste works fine. But disconnect and reconnect the bug will appear!

So far, it seems that as long as I run "only" four gnome-terminal instances, and use xterm for other terminals, I can run gnome-fallback and unity or any window manager, with clipboard manager parcellite running, and not affected by the bug.

If I got hit by the bug with 4 instances of gnome-terminal running, I'll report here again. But other than that, we can probably close this bug with a mysterious warning "don't run too many gnome-terminal simultaneously..."

Fri, 03 Oct 2014 07:52:01 GMT - Antoine Martin:

Ah, OK. That's very interesting.

That must be because they each make a request for the contents at the same time. The -d clipboard log would help (I had typed that wrong previously).

The current limit is set to 10, maybe that's too low:

--- src/xpra/client/gtk2/client.py	(revision 7831)
+++ src/xpra/client/gtk2/client.py	(working copy)
@@ -181,7 +181,7 @@
     def process_clipboard_packet(self, packet):
         clipboardlog("process_clipboard_packet(%s) level=%s", packet, gtk.main_level())
         #check for clipboard loops:
-        if gtk.main_level()>=10:
+        if gtk.main_level()>=25:
             clipboardlog.warn("loop nesting too deep: %s", gtk.main_level())
             clipboardlog.warn("you may have a clipboard forwarding loop, disabling the clipboard")
             self.clipboard_enabled = False

Mon, 06 Oct 2014 06:29:09 GMT - Jiang:

Great, I hope that'll help. I did a debugging session with -d clipboard flag. The outputs are in the two attached files. The setup is with eight gnome-terminal window open to trigger the bug.

Interestingly, in my experience, if the bug is triggered, e.g. with lots of gnome-terminal open, simply closing gnome-terminal windows doesn't help. Disconnect the session and reconnect and the bug is still there.

Only after logging out of the entire gui session and log back in on the client side would restore the normal copy and paste. Restarting xpra server is however not needed.

Mon, 06 Oct 2014 06:29:54 GMT - Jiang: attachment set

Mon, 06 Oct 2014 06:30:09 GMT - Jiang: attachment set

Mon, 06 Oct 2014 14:11:56 GMT - Antoine Martin:

OK, so it looks like all the terminals are requesting the clipboard contents at the same time, as soon as we claim ownership of it (which is lame - the point of the X11 clipboard is that you should only request it when you need it..).

I can't see an easy way around that: we have to use nesting to run the main loop until we get the results...

r7893 bumps the nesting level limit to 40, a loop will increase quickly anyway, so having a high limit is OK, better than hitting it too easily.

Mon, 27 Oct 2014 19:17:48 GMT - Antoine Martin: status changed; resolution set

Not heard back, hopefully 40 is enough here.

Sat, 23 Jan 2021 05:03:28 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/703