Xpra: Ticket #1244: --socket-dir option is ignored

Shortly telling, --socket-dir option has no effect. xpra start creates socket in default location, xpra attach seeks sockets in default location.

Steps to reproduce:

  1. create ${HOME}/.testXpra directory to store sockets
  2. run xpra --socket-dir=${HOME}/.testXpra start :19
  3. expects: socket number 19 in ${HOME}/.testXpra directory
  4. get: socket number 19 in ${HOME}/.xpra directory
  5. get: ${HOME}/.testXpra directory is empty
  6. run xpra --socket-dir=${HOME}/.testXpra
  7. expects: empty list, because ${HOME}/.testExpra is empty
  8. got: list contains single live session at :19

So, from practical perspective --socket-dir is ignored. But it is still correctly parsed. If I replace it with --socket-diir for example, I would get parse error.

version: 0.17.3 OS: Gentoo Linux, rolling release.

Sat, 02 Jul 2016 15:02:58 GMT - Antoine Martin: attachment set

fix for xpra list - with just too many disadvantages

Sat, 02 Jul 2016 15:05:13 GMT - Antoine Martin: owner, description changed

The problem comes from the changes for #963: we now allow multiple sockets to be created for a single server.

The problem with the socket being created in the "wrong" directory comes from the fact that the bind option defaults to a specific path (~/.xpra/) in the default config we ship. And so when we try to create the sockets, this takes precedence over socket-dir. This should be fixed in r12947 by switching to "auto" by default. You can workaround this by:

The second part (fixing "xpra list" to only search "socket-dir") is much harder to fix properly. The patch attached would only search socket-dir, but this is likely to cause more problems than it solves: it would make it impossible to list any sockets not found in "socket-dir" once this option is used. And that's bad, so I will probably just leave it as it is.

Please close if this works for you.

Sun, 03 Jul 2016 11:29:30 GMT - nyavango: status changed; resolution set

I afraid socket-dir-only.patch is too forceful. DotExpra is seemed to be used not only for sockets, but for logs too.

I've tried to set bind option in /etc/xpra/xpra.conf file to auto, and it satisfies all practical needs. So the ticket itself not a bug, but explanation for how to use xpra features properly. There is no need to exclude .xpra sessions from listing explicitly. So all works, fine, it was just a misunderstanding after upgrading from 0.16.x version.

Tue, 12 Jul 2016 16:52:22 GMT - Antoine Martin: milestone changed

Milestone renamed

Sun, 12 Mar 2017 15:00:18 GMT - mviereck:

I'm facing this bug again in xpra v1.0.3-r15051. Maybe I misunderstand something. I checked the config files, bind ist set to auto. I also tried --bind=auto on command line, but the socket does not appear in the folder I specified with --socket-dir. If I use --socket-dir along with --bind=/path/to/socketdir, the socket appears, but if I try to connect to it (with xpra client v0.17.6) I get this error:

2017-03-12 14:23:07,850 New unix-domain connection received on /x11docker/socket/f89aa1c31337-522
2017-03-12 14:23:07,864 Handshake complete; enabling connection
2017-03-12 14:23:08,070 Warning: xxhash python bindings not found
2017-03-12 14:23:08,071  no scrolling detection
2017-03-12 14:23:08,094 server error processing new connection from Protocol(unix-domain socket:/x11docker/socket/f89aa1c31337-522): No module named dbus
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/server/server_core.py", line 893, in _process_hello
    self.hello_oked(proto, packet, c, auth_caps)
  File "/usr/lib/python2.7/dist-packages/xpra/server/server_base.py", line 1115, in hello_oked
    self.default_speed, self.default_min_speed)
  File "/usr/lib/python2.7/dist-packages/xpra/server/source.py", line 357, in __init__
    self.dbus_server = dbus_exception_wrap(make_dbus_server, "setting up client dbus instance")
  File "/usr/lib/python2.7/dist-packages/xpra/server/dbus/dbus_common.py", line 12, in dbus_exception_wrap
    v = fn()
  File "/usr/lib/python2.7/dist-packages/xpra/server/source.py", line 355, in make_dbus_server
    from xpra.server.dbus.dbus_source import DBUS_Source
  File "/usr/lib/python2.7/dist-packages/xpra/server/dbus/dbus_source.py", line 7, in <module>
    from xpra.dbus.helper import dbus_to_native
  File "/usr/lib/python2.7/dist-packages/xpra/dbus/helper.py", line 7, in <module>
    import dbus
ImportError: No module named dbus
2017-03-12 14:23:08,097 Disconnecting client /x11docker/socket/f89aa1c31337-522:
2017-03-12 14:23:08,097  server error (error accepting new connection)

I have set --no-notifications on both server and client. xpra server is within a docker container, xpra client is on host.

As newer xpra versions can handle multiple sockets, can't just be created one more in the directory specified by --socket-dir? That would preserve backwards compatibility.

Sun, 12 Mar 2017 15:40:32 GMT - Antoine Martin:

That's a completely different bug (you don't have python dbus installed), which is fixed in 1.0.4

Sun, 12 Mar 2017 17:10:20 GMT - mviereck:

ok, thanks, installing python-dbus fixes that error.

But the core point persists: in xpra 1.03 --socket-dir only works with setting --bind=/path/to/socketdir. Setting --bind=auto does not work, no socket is created in the specified path.

Older versions of xpra does not accept --bind=/path/to/socketdir. I get:

cannot start server: failed to setup sockets: TCP port must be specified as [HOST]:PORT

I know, you don't like it people using older versions ;-). But as I provide a tool for everyone, I try to be compatible with every xpra version that may be installed. I can (and do) recommend to install from your repo, but don't want my tool to fail if there is an older version on other systems. I can make a workaround, checking xpra version and using different commands to run xpra depending on its version number.

It would be more nice if xpra is backwards compatible with -- socket-dir if the config file contains bind = auto. That was the way I understood your comment above.

Mon, 13 Mar 2017 10:09:24 GMT - Antoine Martin:

@mviereck: try r15287, it does what you want - I guess it can be argued that this fixes command line backwards compatibility so this may get applied at some point to the 1.0.x branch - but it will need further testing first, 2.0 is likely to be released before the next 1.0 update anyway so this should happen.

As for "not liking people using older versions": what people do is their own business, but:

Tue, 28 Mar 2017 14:13:23 GMT - mviereck:

Thank you, I've tested with xpra v2.0-r15319, now --socket-dir works on its own again without using --bind.

Sat, 23 Jan 2021 05:18:58 GMT - migration script:

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