Xpra: Ticket #452: detect and avoid creating clipboard loops

If I shadow a display somewhere, then shadow again back to original display, I have created a loop... which creates havoc with the nested loop clipboard code:

Maximum recursion depth exceeded
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/server/window_source.py", line 451, in expire_delayed_region
  File "/usr/lib64/python2.7/site-packages/xpra/server/window_source.py", line 506, in may_send_delayed
  File "/usr/lib64/python2.7/site-packages/xpra/server/window_source.py", line 513, in do_send_delayed_region
  File "/usr/lib64/python2.7/site-packages/xpra/server/window_source.py", line 552, in send_delayed_regions
    log.error("send_delayed_regions: error processing region %s: %s", damage, e, exc_info=True)
  File "/usr/lib64/python2.7/site-packages/xpra/log.py", line 34, in <lambda>
    self.log(level, msg, *args, **kwargs))
  File "/usr/lib64/python2.7/site-packages/xpra/log.py", line 30, in log
    self.logger.log(level, msg, *args, **kwargs)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1218, in log
    self._log(level, msg, args, **kwargs)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1264, in _log
    fn, lno, func = self.findCaller()
  File "/usr/lib64/python2.7/logging/__init__.py", line 1225, in findCaller
    f = currentframe()
RuntimeError: maximum recursion depth exceeded

We should detect when the nesting level gets high, and disable the clipboard.

Preferably, we would also have a way to avoid getting in that situation in first place.

Tue, 03 Dec 2013 14:34:01 GMT - Antoine Martin:

r4845 disables the clipboard temporarily when the level of nesting gets too high (needs backporting to v0.10.x).

r4847 does this more properly (see changelog message for details) and when the server detects the loop, the client should see:

clipboard toggled to False by the server, reason: probable clipboard loop detected

Last remaining issue: we show the clipboard icon in the tray because of pending requests... but when we disable the clipboard, this should be reset.

Tue, 03 Dec 2013 14:57:24 GMT - Antoine Martin: status changed; resolution set

the tray icon issue is solved by r4850 (may get backported as it turned out to be small and simple). Closing.

Mon, 18 May 2015 16:34:25 GMT - Antoine Martin:

Related change in later versions: r7751.

The real long term solution is #812

Sat, 23 Jan 2021 04:55:56 GMT - migration script:

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