Xpra: Ticket #2323: Xpra tries to use unix domain socket as a TCP one

I run Xpra as xpra start --daemon=no --html=on --start=xterm Here is a part of the beginning of the log

2019-06-07 17:35:53,749 created unix domain socket: /run/user/0/xpra/2481a722a4d1-0
2019-06-07 17:35:53,749 created unix domain socket: /run/xpra/2481a722a4d1-0
2019-06-07 17:35:53,750 Warning: missing sound module
2019-06-07 17:35:53,902 pointer device emulation using XTest
2019-06-07 17:35:53,948 serving html content from: /usr/share/xpra/www
2019-06-07 17:35:55,400  OpenGL is supported on display ':0'
2019-06-07 17:35:55,401  using 'llvmpipe (LLVM 6.0, 256 bits)' renderer
2019-06-07 17:35:55,462 D-Bus notification forwarding is available
2019-06-07 17:35:55,612 Warning: webcam forwarding is disabled
2019-06-07 17:35:55,612  the virtual video directory '/sys/devices/virtual/video4linux' was not found
2019-06-07 17:35:55,612  make sure that the 'v4l2loopback' kernel module is installed and loaded
2019-06-07 17:35:55,612 found 0 virtual video devices for webcam forwarding
2019-06-07 17:35:55,635 Warning: cannot use application menu data:
2019-06-07 17:35:55,636  no python-xdg module
2019-06-07 17:35:55,636 xpra GTK2 X11 version 2.5-r22138 64-bit
2019-06-07 17:35:55,643 printer forwarding enabled using postscript and pdf
2019-06-07 17:35:55,643  uid=0 (root), gid=0 (root)
2019-06-07 17:35:55,644  running with pid 1 on Linux CentOS Linux 7.5.1804 Core
2019-06-07 17:35:55,645  connected to X11 display :0 with 24 bit colors
2019-06-07 17:35:55,741 xpra is ready.

then I expose the unix socket at a TCP port with socatsocat TCP-LISTEN:8000,fork UNIX:/run/user/0/xpra/2481a722a4d1-0 — and connect to it from a browser and see the following in the log:

2019-06-07 17:36:05,536 Handshake complete; enabling connection
2019-06-07 17:36:05,590  automatic picture encoding enabled, also available:
2019-06-07 17:36:05,590   jpeg, png, rgb32, h264, mpeg1
2019-06-07 17:36:05,591 Warning: failed to query IP_OPTIONS, IP_TOS, IP_TTL
2019-06-07 17:36:05,592 Warning: failed to query TCP_NODELAY, TCP_MAXSEG
2019-06-07 17:36:05,593 HTML5 Posix Firefox client version 2.5.1
2019-06-07 17:36:05,682 setting keyboard layout to 'us'
2019-06-07 17:36:05,721  client root window size is 1440x689 with 1 display:
2019-06-07 17:36:05,721   HTML (381x182 mm - DPI: 96x96)
2019-06-07 17:36:05,721     Canvas
2019-06-07 17:36:05,750 server virtual display now set to 1408x640 (best match for 1440x689)
2019-06-07 17:36:05,761 Error: write connection ws socket:/run/user/0/xpra/2481a722a4d1-0 reset
2019-06-07 17:36:05,762  [Errno 95] Operation not supported
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/net/protocol.py", line 638, in _io_thread_loop
    while not self._closed and callback():
  File "/usr/lib64/python2.7/site-packages/xpra/net/protocol.py", line 665, in _write
    return self.write_items(*items)
  File "/usr/lib64/python2.7/site-packages/xpra/net/protocol.py", line 685, in write_items
    conn.set_nodelay(True)
  File "/usr/lib64/python2.7/site-packages/xpra/net/bytestreams.py", line 314, in set_nodelay
    self.do_set_nodelay(nodelay)
  File "/usr/lib64/python2.7/site-packages/xpra/net/bytestreams.py", line 317, in do_set_nodelay
    self._socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, nodelay)
  File "/usr/lib64/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 95] Operation not supported
2019-06-07 17:36:05,814 client got hello: server version 2.5 accepted our connection
2019-06-07 17:36:05,828 Warning: failed to add printer HTML5 client: failed to connect to server
2019-06-07 17:36:05,832 client connection_progress( Session started ,   ,  100 )
2019-06-07 17:36:05,838 DPI set to 96 x 96
2019-06-07 17:36:05,838 Warning: failed to query IP_OPTIONS, IP_TOS, IP_TTL
2019-06-07 17:36:05,838 Warning: failed to query TCP_NODELAY, TCP_MAXSEG
2019-06-07 17:36:05,839 xpra client 1 disconnected.

HTML5 client tries to reconnect again and again causing the same error.



Fri, 07 Jun 2019 19:23:00 GMT - Antoine Martin: owner, status changed

Please see wiki/ReportingBugs.

For a start, I don't know what OS / version you're using. TCP_NODELAY is not normally privileged.


Fri, 07 Jun 2019 19:39:37 GMT - berserker: owner changed

Replying to Antoine Martin:

For a start, I don't know what OS / version you're using.

Everything is in the log:

xpra GTK2 X11 version 2.5-r22138 64-bit
running with pid 1 on Linux CentOS Linux 7.5.1804 Core

TCP_NODELAY is not normally privileged.

Don't understand how privileges should affect this bug. Unix domain sockets just can't into the TCP_NODELAY option, no matter which privileges you got.


Sat, 08 Jun 2019 03:42:53 GMT - Antoine Martin: status changed; resolution set

xpra GTK2 X11 version 2.5-r22138 64-bit

Sorry I missed that. That's a little bit out of date.

running with pid 1 on Linux CentOS Linux 7.5.1804 Core

That's not normal, so you'be left some of the details out. xpra does not run as pid 1 unless you're doing something with containers. (and you're also running as root...)

Unix domain sockets just can't into the TCP_NODELAY option, no matter which privileges you got.

Ah, right, the socat part. This is an issue since 2.5 because we got rid of websockify (details in #2121) and added better support for TCP_CORK and TCP_NODELAY (#619 and #2130). So we assumed (wrongly) that websocket connections come over TCP-like sockets. That's fixed in r22882 + r22883. You can apply these 2 tiny patches by hand or wait for the next update.

Thanks for the report!


Sat, 08 Jun 2019 14:01:50 GMT - berserker:

Replying to Antoine Martin:

That's fixed in r22882 + r22883.

Thank you, this solved the issue!

However, some Warnings are still in the log:

Warning: failed to query IP_OPTIONS, IP_TOS, IP_TTL
Warning: failed to query TCP_NODELAY, TCP_MAXSEG

They are harmless, but maybe it is worth fixing them so users won't be confused?


Sat, 08 Jun 2019 16:12:54 GMT - Antoine Martin:

Good point, r22886 should take care of that.


Sat, 23 Jan 2021 05:48:14 GMT - migration script:

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