Xpra: Ticket #156: large clipboard packets cause the connection to drop

I cut-n-paste a page of html from firefox running locally to evolution running over xpra, it consistently crashes the xpra client:

Attached (press Control-C to detach)
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 530, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 483, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/martin/stuff/xpra/Xpra/trunk/src/install/lib/python/xpra/proxy.py", line 25, in _to_client_loop
    self._copy_loop("<-server", self._server_conn, self._client_conn)
  File "/home/martin/stuff/xpra/Xpra/trunk/src/install/lib/python/xpra/proxy.py", line 35, in _copy_loop
    buf = from_conn.read(4096)
  File "/home/martin/stuff/xpra/Xpra/trunk/src/install/lib/python/xpra/protocol.py", line 68, in read
    return self._s.recv(n)
error: [Errno 104] Connection reset by peer
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 530, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 483, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/martin/stuff/xpra/Xpra/trunk/src/install/lib/python/xpra/proxy.py", line 29, in _to_server_loop
    self._copy_loop("->server", self._client_conn, self._server_conn)
  File "/home/martin/stuff/xpra/Xpra/trunk/src/install/lib/python/xpra/proxy.py", line 42, in _copy_loop
    buf = buf[to_conn.write(buf):]
  File "/home/martin/stuff/xpra/Xpra/trunk/src/install/lib/python/xpra/protocol.py", line 71, in write
    return self._s.send(buf)
error: [Errno 32] Broken pipe
Connection lost

On the server log it says:

connection lost: read buffer too big: 40960 (maximum is 32768), dropping this connection!
Connection lost
xpra client disconnected.

I am running r990 both ends.



Mon, 02 Jul 2012 06:33:45 GMT - Antoine Martin: status, description, summary changed

Thanks very much for the detailed bug report!

This bug was introduced by r784 (see #68): we set a maximum packet size for client packets, and your clipboard packet is bigger than that... (something I never tested)

The fix in r994 is to increase the maximum client packet size to 1MB and to force zlib compression on those clipboard packets. I am unsure whether it makes sense to allow anything bigger than 1MB as clipboard contents over the network... I guess that if we do not, what we should do is drop the clipboard contents rather than the connection! (so keeping this ticket open for now)


Mon, 02 Jul 2012 08:27:26 GMT - Martin Ebourne:

Thx for the fix, will try it out.

Cut-n-paste of screen shots/images would exceed 1MB perhaps? I don't generally do this over remote, but certainly do locally and seems reasonable to allow it.


Mon, 09 Jul 2012 06:56:23 GMT - Martin Ebourne:

Confirming fix works for me.


Mon, 27 Aug 2012 17:56:38 GMT - Antoine Martin: status changed; resolution set

Fixed properly:

We will drop the packets before they cause problems. 0.5 and later do this after compressing the clipboard packet whereas earlier versions cannot (and therefore their clipboard packet limit will be lower)


Sat, 23 Jan 2021 04:47:03 GMT - migration script:

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