Opened 6 years ago

Last modified 4 years ago

#241 assigned defect

Intermittent phantom session on start-up of new session

Reported by: madmonk Owned by: madmonk
Priority: minor Milestone:
Component: Server Keywords:
Cc:

Description (last modified by Antoine Martin)

I was doing some basic testing of the application in this instance simulating start-up / shut-down of an application session looking for freezes and failures etc. In this particular instance this was done by starting and stopping Firefox several times in a row. I noted that after a while I was accumulating additional unknown sessions that can not be recovered and that are marked as starting on the client but never progress.

Just to note that it seems that the additional phantom session appears when starting a new session rather than being left over from a session which did not terminate correctly.

System Details

Distributor ID: Ubuntu
Description:    Ubuntu 12.04.2 LTS
Release:        12.04
Codename:       precise
3.2.0-51-generic-pae #77-Ubuntu SMP Wed Jul 24 20:40:32 UTC 2013 i686 i686 i386 GNU/Linux
Qt: 4.8.1
KDE Development Platform: 4.8.5 (4.8.5)
KDE Daemon: $Id$
ii  winswitch                   0.12.20-1                   tool to start and control remote sessions
[II] 2013/13/11 22:42:26.504197 applet.<module>() python version 2.7.3 (default, Apr 10 2013, 05:46:21) \n[GCC 4.6.3]
[II] 2013/13/11 22:42:26.504295 applet.<module>() gtk version (2, 24, 10), pygtk version (2, 24, 0)
[II] 2013/13/11 22:42:26.582558 main_loop.loop_init(True) twisted version 11.1.0
[II] 2013/13/11 22:42:26.583285 globals os.uname=('Linux', 'testx', '3.2.0-51-generic-pae', '#77-Ubuntu SMP Wed Jul 24 20:40:32 UTC 2013', 'i686')
[II] 2013/13/11 22:42:26.586679 globals python package info: __version__=0.12.20
[II] 2013/13/11 22:42:26.586869 globals version=0.12.20 (svn revision unknown - unknown local modifications), \
    built on winswitch.org by buildbot, 2013-11-05, release_build=True

Steps to reproduce

  • 1 Start Firefox
  • 2 Browse for a bit e.g. wikipedia, google etc.
  • 3 Stop Firefox
  • 4 Repeat (check Winswitch after step 1 for additional unknown session)

From server after shut-down of a Firefox app session

drwxrwxrwx 2 x x 4096 Nov 13 22:45 100
drwxrwxrwx 2 x x 4096 Nov 13 23:07 104
drwxrwxrwx 2 x x 4096 Nov 13 23:12 109
drwxrwxrwx 2 x x 4096 Nov 13 23:15 110

(Other session are also orphaned / unknown sessions from testing)

From server after start-up of new Firefox app session

drwxrwxrwx 2 x x 4096 Nov 13 22:45 100
drwxrwxrwx 2 x x 4096 Nov 13 23:07 104
drwxrwxrwx 2 x x 4096 Nov 13 23:12 109
drwxrwxrwx 2 x x 4096 Nov 13 23:15 110
drwxrwxrwx 2 x x 4096 Nov 13 23:16 113
drwxrwxrwx 5 x x 4096 Nov 13 23:16 116

Excerpt from client log...

[II] 2013/13/11 23:15:56.764592 XpraClientUtil.ended(<winswitch.util.process_util.SimpleLineProcess instance at 0x99d36ac>) session=ClientSession(:113 - xpra - closed), kill_client=True
[DD] 2013/13/11 23:15:56.764764 SimpleLineProcess.processEnded([Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ProcessDone'>: A process has ended without apparent errors: process finished with exit code 0.\n])
[DD] 2013/13/11 23:16:25.868591 WinSwitchApplet.start_menu_callback(<gtk.ImageMenuItem object at 0x99d95cc (GtkImageMenuItem at 0x967ed00)>,ServerConfig(browser:8796763313898),Command(Firefox Web Browser: firefox --no-remote %u))
[DD] 2013/13/11 23:16:25.871248 WinSwitchApplet.is_modifier_set() modifiers=[]
[II] 2013/13/11 23:16:25.871319 WinSwitchApplet.do_start_session(ServerConfig(browser:8796763313898),Command(Firefox Web Browser: firefox --no-remote %u),xpra,None,None,False)
[II] 2013/13/11 23:16:25.871384 WinSwitchApplet.attention(Starting Firefox Web Browser,None)
[DD] 2013/13/11 23:16:25.871431 AppIndicatorTray.request_attention(Starting Firefox Web Browser,5)
[DD] 2013/13/11 23:16:25.871836 XpraClientUtil.load_options_defaults() nothing to do: the file has not changed
[DD] 2013/13/11 23:16:25.871903 ServerLineConnection.start_session(648fda4c3aba18dc2d6144a8bb2cce86,xpra,None,{'read_only': 'False', 'mmap': 'True', 'keyboard_sync': 'True', 'clipboard': 'True', 'encoding': '""'})
[DD] 2013/13/11 23:16:26.189093 ServerLineConnection.add_session([...]) existing=None, was_pre_connected_here=None, session=ClientSession(:116 - xpra - starting)
[II] 2013/13/11 23:16:26.189269 ServerLink.add_port_forward(None,127.0.0.1,15117) adding new port forward
[II] 2013/13/11 23:16:26.189399 ConchConnection.forward_port(12479,127.0.0.1,15117)
[DD] 2013/13/11 23:16:26.189633 ServerLink.add_port_forward(12479,127.0.0.1,15117) forwarder=(<<class 'twisted.internet.tcp.Port'> of twisted.conch.ssh.forwarding.SSHListenForwardingFactory on 12479>, 12479, '127.0.0.1', 15117)
[DD] 2013/13/11 23:16:27.314688 ServerLineConnection.add_session([...]) existing=None, was_pre_connected_here=None, session=ClientSession(:113 - xpra - starting)
[II] 2013/13/11 23:16:27.314910 ServerLink.add_port_forward(None,127.0.0.1,15119) adding new port forward
[II] 2013/13/11 23:16:27.315073 ConchConnection.forward_port(12480,127.0.0.1,15119)

Attachments (2)

pip-freeze.log (1.6 KB) - added by madmonk 6 years ago.
pip freeze
Cleanup dead sockets on session exit.patch (625 bytes) - added by Nathan Rennie-Waldock 4 years ago.

Download all attachments as: .zip

Change History (11)

Changed 6 years ago by madmonk

Attachment: pip-freeze.log added

pip freeze

comment:1 Changed 6 years ago by Antoine Martin

Description: modified (diff)
Owner: set to madmonk
Status: newassigned

Two things that are likely to cause problems here, especially when combined:

  • Firefox is very problematic because of the way it only allows a single instance at a time - by the time you start it again, it may still be confused about where it should run and try to run in the instance that you are shutting down. We are keeping track of commands that can only be run once and you should get a notification warning (DE permitting) when you try to start a second one. Except... if we are shutting it down or if it is stuck, then you may have more problems.

Not much more we can do about that I don't think...

  • Session pre-loading and pre-connecting: this is what is causing those extra sessions you are seeing. Xpra is so fast to start that it makes little difference to startup time. When this is enabled and working properly - there is no difference to startup time between a local app and a "remotized" app, with it disabled you have to start the xpra server and client for each application - which may take about half a second.

To disable this feature, edit:

.winswitch/server/server.conf

And disable: prelaunch_enabled then restart your server (or applet).
Does this help?

Last edited 6 years ago by Antoine Martin (previous) (diff)

comment:2 Changed 6 years ago by madmonk

Thanks for the feedback.

I haven't had a chance to look into this yet but it's worth noting that I haven't seen any issues when using nx rather than xpra and doing the same things. It does seem related to xpra somehow as I've seen an unknown session pop-up locally when I haven't even connected to the system or run anything on the local server although there was at least one xpra process running which is what got detected I think.

If I get some time I will see if I can look into this further. Perhaps it would be worth creating a test harness or something to automate a few tests such as randomly starting and shutting down applications.

comment:3 Changed 6 years ago by Antoine Martin

I haven't seen any issues when using nx rather than xpra and doing the same things

As per comment:1, please try the prelaunch settings, NX does not do any prelaunch so it would not be affected. And your symptoms match exactly what prelaunch does: the prelaunched sessions are empty until we really do start something.

comment:4 Changed 6 years ago by madmonk

I turned prelaunch off (I set prelaunch_enabled=False in both server.conf files and rebooted both machines before testing just to make sure the config file was picked up) but I'm still getting unknown sessions appearing
It looks as if 2 copies of firefox start up at once but obviously only 1 actually starts and the other is left orphaned. I think this is probably making the memory leak worse at I think it might have been some of the background xpra processes using up all the memory. It's probably wasting some resource on the machine at the very least, and definitely looks untidy.

Even if prelaunch was not disabled for some reason it looks as if what occurs on the server is not right. I would have assumed that there would be some sort of n+1 strategy and this would be maintained each time an application was started or shut-down. I'm guessing if this was working it would be trivial to add something to mask the additional pre-launch process from the client.

comment:5 Changed 6 years ago by madmonk

Addition testing from cmd line with debug on and prelaunch_enabled=False in server.conf

on client:

[II] 2013/18/11 18:10:12.188030 WinSwitchApplet.do_start_session(ServerConfig(browser:8796763313898),Command(Firefox Web Browser: firefox --no-remote %u),xpra,None,None,False)
[II] 2013/18/11 18:10:12.188220 WinSwitchApplet.attention(Starting Firefox Web Browser,None)
[II] 2013/18/11 18:10:23.124877 ServerLink.add_port_forward(None,127.0.0.1,15066) adding new port forward
[II] 2013/18/11 18:10:23.125057 ConchConnection.forward_port(12465,127.0.0.1,15066)
[II] 2013/18/11 18:10:32.031205 ServerLink.add_port_forward(None,127.0.0.1,15068) adding new port forward
[II] 2013/18/11 18:10:32.031336 ConchConnection.forward_port(12466,127.0.0.1,15068)
[II] 2013/18/11 18:10:41.077442 ProtocolHandler.do_encrypted_command(...) decrypted command=send_session 

[II] 2013/18/11 18:10:41.078559 XpraClientUtil.attach(ServerConfig(<svr>:8796763313898),ClientSession(:65 - xpra - connecting),127.0.0.1,12465)
[II] 2013/18/11 18:10:41.079064 XpraClientUtil.do_real_attach() pre_connected=False, preload=False, has min=True
[II] 2013/18/11 18:10:41.079304 XpraClientUtil.exec_client(ServerConfig(<svr>:8796763313898),ClientSession(:65 - xpra - connecting),['/usr/bin/xpra', '--title=@title@  (on browser)', '--session-name=Firefox Web Browser', '--password-file=/home/<usr>/.winswitch/client/sessions/69548df868cb43e08e06a41386ec67e2/session.pass', '--window-icon=/home/<usr>/.winswitch/client/sessions/69548df868cb43e08e06a41386ec67e2/session.icon', 'attach', 'tcp:127.0.0.1:12465'],None,None,None,True) starting SimpleLineProcess
[II] 2013/18/11 18:10:41.081682 XpraClientUtil.started(<winswitch.util.process_util.SimpleLineProcess instance at 0xa23df8c>) pid=None
[II] 2013/18/11 18:10:41.082491 SimpleLineProcess.start() process(['/usr/bin/xpra', '--title=@title@  (on browser)', '--session-name=Firefox Web Browser', '--password-file=/home/<usr>/.winswitch/client/sessions/69548df868cb43e08e06a41386ec67e2/session.pass', '--window-icon=/home/<usr>/.winswitch/client/sessions/69548df868cb43e08e06a41386ec67e2/session.icon', 'attach', 'tcp:127.0.0.1:12465'])=<Process pid=3376 status=-1>
[II] 2013/18/11 18:10:41.305442 PortForwardChannel.__init__(<winswitch.net.conch_util.ConchConnection instance at 0xb3a833ac>,<function forwarding_ready at 0xa158ed4>,<function forwarding_failed at 0xa232f44>)
[II] 2013/18/11 18:10:41.305651 ConchConnection.openChannel(<winswitch.net.conch_util.PortForwardChannel instance at 0xa24122c>,'\x00\x00\x00\t127.0.0.1\x00\x00:\xda\x00\x00\x00\t127.0.0.1\x00\x00\x81\x0b')
[II] 2013/18/11 18:10:41.743641 ServerLink.forwarding_ready()

on server:

[II] 2013/18/11 18:10:12.438986 WinSwitchClientChannel.start_session(7552bbdf050b3305174719db0384b3eb,xpra,,read_only=False;encoding="vpx";mmap=True;no-microphone=;auto-refresh-delay=1;clipboard=True;no-pulseaudio=;no-speaker=;keyboard_sync=True;quality=50;speed=1;) command=Command(Firefox Web Browser: firefox --no-remote %u), user=User(<usr> : ...e578df974e7b17)
[II] 2013/18/11 18:10:12.575257 WinSwitchServer.start_session(User(<usr> : ...e578df974e7b17),xpra,Command(Firefox Web Browser: firefox --no-remote %u),,{'read_only': 'False', 'quality': '50', 'encoding': '"vpx"', 'mmap': 'True', 'no-microphone': '', 'auto-refresh-delay': '1', 'clipboard': 'True', 'no-speaker': '', 'keyboard_sync': 'True', 'no-pulseaudio': '', 'speed': '1'},None)
[II] 2013/18/11 18:10:15.546793 XpraServerUtil.start_dbus(ServerSession(:65 - xpra - starting)) dbus_pid=7458, dbus_address=unix:abstract=/tmp/dbus-hAWDm3sk1K,guid=adc08df82d5c835e3d0787d900003182
[II] 2013/18/11 18:10:20.041968 virt_server_daemonizer.grab_daemon_pid(['/usr/lib/winswitch/virt_server_daemonizer', '--quiet', '--print-pid', '--daemon', '--log-file', '/home/<usr>/.winswitch/server/sessions/65/pulse.log', '--', '/usr/bin/pulseaudio', '--start', '-vvvv', '--disable-shm=true', '--daemonize=false', '--use-pid-file=false', '--system=false', '--exit-idle-time=-1', '-n', '--load=module-suspend-on-idle', '--load=module-null-sink', '--load=module-native-protocol-unix socket=/tmp/pulse-65/native'],None,{'LANG': 'en_GB.UTF-8', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-hAWDm3sk1K,guid=adc08df82d5c835e3d0787d900003182', 'PWD': '/home/<usr>', 'USER': '<usr>', 'HOME': '/home/<usr>/.winswitch/server/sessions/65', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games', 'DISPLAY': ':65'}) returncode=0, stdoutdata=7466\n, stderrdata=, pid=7466
[II] 2013/18/11 18:10:20.220810 XpraServerUtil.start_daemon(ServerSession(:65 - xpra - starting),{'LANG': 'en_GB.UTF-8', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-hAWDm3sk1K,guid=adc08df82d5c835e3d0787d900003182', 'PWD': '/home/<usr>', 'PULSE_SERVER': 'unix:/tmp/pulse-65/native', 'USER': '<usr>', 'HOME': '/home/<usr>', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games', 'DISPLAY': ':65', 'ALSA_PCM_NAME': 'pulse'},True) starting ['/usr/bin/xpra', '--bind-tcp=127.0.0.1:15066', '--password-file=/home/<usr>/.winswitch/server/sessions/65/session.pass', '--no-daemon', '--session-name=Firefox Web Browser', 'start', ':65'], logging to /home/<usr>/.winswitch/server/sessions/65/xpra.log
[II] 2013/18/11 18:10:20.424065 virt_server_daemonizer.grab_daemon_pid(['/usr/lib/winswitch/virt_server_daemonizer', '--quiet', '--print-pid', '--daemon', '--log-file', '/home/<usr>/.winswitch/server/sessions/65/xpra.log', '--', '/usr/bin/xpra', '--bind-tcp=127.0.0.1:15066', '--password-file=/home/<usr>/.winswitch/server/sessions/65/session.pass', '--no-daemon', '--session-name=Firefox Web Browser', 'start', ':65'],/home/<usr>,{'LANG': 'en_GB.UTF-8', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-hAWDm3sk1K,guid=adc08df82d5c835e3d0787d900003182', 'PWD': '/home/<usr>', 'PULSE_SERVER': 'unix:/tmp/pulse-65/native', 'USER': '<usr>', 'HOME': '/home/<usr>', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games', 'DISPLAY': ':65', 'ALSA_PCM_NAME': 'pulse'}) returncode=0, stdoutdata=7475\n, stderrdata=, pid=7475
[II] 2013/18/11 18:10:20.424321 XpraServerUtil.session_process_started(7475,ServerSession(:65 - xpra - starting))
[II] 2013/18/11 18:10:21.828788 XpraServerUtil.do_watch_session_log(/home/<usr>/.winswitch/server/sessions/65/xpra.log,27,ServerSession(:65 - xpra - starting)) watching log with gio: <__main__.GInotifyFileMonitor object at 0xb2519b1c (GInotifyFileMonitor at 0x94f7de8)>
[II] 2013/18/11 18:10:23.044460 WinSwitchServer.send_session_to_all(ServerSession(:65 - xpra - starting)) clients=[WinSwitchClientChannel(User(<usr> : ...e578df974e7b17))]
[II] 2013/18/11 18:10:23.109068 XpraServerUtil.wait_for_session_readyness(ServerSession(:65 - xpra - starting),User(<usr> : ...e578df974e7b17),<function session_started at 0x994c9cc>,<function session_error at 0x994c4c4>) adding/firing session status update callbacks
[II] 2013/18/11 18:10:25.686655 virt_server_daemonizer.grab_daemon_pid(['/usr/lib/winswitch/virt_server_daemonizer', '--quiet', '--print-pid', '--daemon', '--log-file', '/home/<usr>/.winswitch/server/sessions/65/dbus-send-disable-gnome-screensaver.log', '--', 'dbus-send', '--session', '--dest=org.gnome.ScreenSaver', '--print-reply', '--type=method_call', '--reply-timeout=20000', '/org/gnome/ScreenSaver', 'org.gnome.ScreenSaver.Inhibit', 'string:"Window Switch"', 'string:"Virtual Session"'],None,{'LANG': 'en_GB.UTF-8', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-hAWDm3sk1K,guid=adc08df82d5c835e3d0787d900003182', 'PWD': '/home/<usr>', 'PULSE_SERVER': 'unix:/tmp/pulse-65/native', 'USER': '<usr>', 'HOME': '/home/<usr>', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games', 'DISPLAY': ':65', 'ALSA_PCM_NAME': 'pulse'}) returncode=0, stdoutdata=7491\n, stderrdata=, pid=7491
[II] 2013/18/11 18:10:26.345088 XpraServerUtil.detect_sessions() found: [('UNKNOWN', ':64'), ('UNKNOWN', ':65'), ('LIVE', ':61')]
[II] 2013/18/11 18:10:31.730303 XpraServerUtil.detected_new_session(UNKNOWN,:64) captured xpra session: ServerSession(:64 - xpra - starting)
[II] 2013/18/11 18:10:31.730433 XpraServerUtil.init_upgraded_session(ServerSession(:64 - xpra - starting))
[II] 2013/18/11 18:10:31.730741 WinSwitchServer.send_session_to_all(ServerSession(:64 - xpra - starting)) clients=[WinSwitchClientChannel(User(<usr> : ...e578df974e7b17))]
[II] 2013/18/11 18:10:31.907519 WinSwitchServer.send_session_to_all(ServerSession(:64 - xpra - starting)) clients=[WinSwitchClientChannel(User(<usr> : ...e578df974e7b17))]
[II] 2013/18/11 18:10:33.374327 XpraServerUtil.err_info(connection failed: [Errno 111] Connection refused)
[II] 2013/18/11 18:10:33.374847 XpraServerUtil.start_daemon(ServerSession(:64 - xpra - starting),{'LANG': 'en_GB.UTF-8', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'PWD': '/home/<usr>', 'USER': '<usr>', 'HOME': '/home/<usr>', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games', 'DISPLAY': ':64'},True) starting ['/usr/bin/xpra', '--bind-tcp=127.0.0.1:15068', '--password-file=/home/<usr>/.winswitch/server/sessions/64/session.pass', '--no-daemon', '--session-name=unknown', 'upgrade', ':64'], logging to /home/<usr>/.winswitch/server/sessions/64/xpra.log
[II] 2013/18/11 18:10:33.505625 virt_server_daemonizer.grab_daemon_pid(['/usr/lib/winswitch/virt_server_daemonizer', '--quiet', '--print-pid', '--daemon', '--log-file', '/home/<usr>/.winswitch/server/sessions/64/xpra.log', '--', '/usr/bin/xpra', '--bind-tcp=127.0.0.1:15068', '--password-file=/home/<usr>/.winswitch/server/sessions/64/session.pass', '--no-daemon', '--session-name=unknown', 'upgrade', ':64'],/home/<usr>,{'LANG': 'en_GB.UTF-8', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'PWD': '/home/<usr>', 'USER': '<usr>', 'HOME': '/home/<usr>', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games', 'DISPLAY': ':64'}) returncode=0, stdoutdata=7533\n, stderrdata=, pid=7533
[II] 2013/18/11 18:10:33.505776 XpraServerUtil.session_process_started(7533,ServerSession(:64 - xpra - starting))
[II] 2013/18/11 18:10:33.506030 XpraServerUtil.do_watch_session_log(/home/<usr>/.winswitch/server/sessions/64/xpra.log,28,ServerSession(:64 - xpra - starting)) watching log with gio: <__main__.GInotifyFileMonitor object at 0xb2526edc (GInotifyFileMonitor at 0x94f7e30)>
[EE] 2013/18/11 18:10:33.506919 XpraServerUtil.err_version(connection failed: [Errno 111] Connection refused)
[II] 2013/18/11 18:10:33.616719 XpraServerUtil.err_info(connection failed: [Errno 111] Connection refused)
[II] 2013/18/11 18:10:34.621074 XpraServerUtil.detect_sessions() found: [('UNKNOWN', ':64'), ('UNKNOWN', ':65'), ('LIVE', ':61')]
[II] 2013/18/11 18:10:35.422273 XpraServerUtil.process_log_data(ServerSession(:65 - xpra - starting),1 lines) setting new status=available from line=2013-11-18 18:10:34,776 xpra is ready.\n
[II] 2013/18/11 18:10:35.422683 WinSwitchServer.send_session_status_to_all(ServerSession(:65 - xpra - starting),available) clients=[WinSwitchClientChannel(User(<usr> : ...e578df974e7b17))]
[II] 2013/18/11 18:10:35.518576 XpraServerUtil.start_gnome_keyring_daemon(ServerSession(:65 - xpra - available)) gnome_keyring_env={'GNOME_KEYRING_CONTROL': '/home/<usr>/.winswitch/server/sessions/65/gnome-keyring', 'SSH_AUTH_SOCK': '/home/<usr>/.winswitch/server/sessions/65/gnome-keyring/ssh', 'GPG_AGENT_INFO': '/home/<usr>/.winswitch/server/sessions/65/gnome-keyring/gpg:0:1', 'GNOME_KEYRING_PID': '7567'}, pid=7567
[II] 2013/18/11 18:10:40.681540 XpraServerUtil.start_session_wrapper(ServerSession(:65 - xpra - available)) pid(['/usr/lib/winswitch/delayed_start', '/home/<usr>/.winswitch/server/sessions/65/config.txt', '--print-pid', '--daemon', '--log-file', '/home/<usr>/.winswitch/server/sessions/65/command.log'])=7624
[II] 2013/18/11 18:10:40.681895 WinSwitchServer.do_send_session_to_user(ServerSession(:65 - xpra - available),...e578df974e7b17,1384798270.68) found matching channel WinSwitchClientChannel(User(<usr> : ...e578df974e7b17))
[II] 2013/18/11 18:10:40.682100 WinSwitchServer.send_session_status_to_all(ServerSession(:65 - xpra - available),connecting) clients=[WinSwitchClientChannel(User(<usr> : ...e578df974e7b17))]
[II] 2013/18/11 18:10:40.682432 WinSwitchServer.send_session_status_to_all(ServerSession(:65 - xpra - connecting),None) clients=[WinSwitchClientChannel(User(<usr> : ...e578df974e7b17))]
[II] 2013/18/11 18:10:42.844148 XpraServerUtil.process_log_data(ServerSession(:65 - xpra - connecting),9 lines) setting new status=connected from line=2013-11-18 18:10:41,911 Password matches!\n
[II] 2013/18/11 18:10:42.844358 XpraServerUtil.process_log_data(ServerSession(:65 - xpra - connecting),9 lines) setting new status=connected from line=2013-11-18 18:10:42,360 Python/Gtk2 Linux client version 0.10.9 connected from '<svr>' as '<usr>' ('<usr>')\n
[II] 2013/18/11 18:10:42.844672 WinSwitchServer.send_session_status_to_all(ServerSession(:65 - xpra - connecting),connected) clients=[WinSwitchClientChannel(User(<usr> : ...e578df974e7b17))]

comment:6 Changed 4 years ago by Nathan Rennie-Waldock

I'm seeing this too. It doesn't seem to happen with delete_session_files=False (started and quit over 100 sessions, no unknown ones).

My steps:
Start a command (I'm using lxterminal), gets display :62
Quit it
Start another
unknown session starts on :62 and new session starts on :63

  PID TTY      STAT   TIME COMMAND
 1250 ?        S      0:00 /usr/bin/python /usr/bin/xpra --bind-tcp=127.0.0.1:15066 --password-file=/home/administrator/.winswitch/server/sessions/62/session.pass --no-daemon --session-name=unknown upgrade :62
32309 ?        Ssl    0:00 Xorg-for-Xpra-:62 -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile /home/administrator/.xpra/Xorg.:62.log -config /etc/xpra/xorg.conf :62

comment:7 Changed 4 years ago by Nathan Rennie-Waldock

Component: ClientServer

I've managed to find what's causing this. It looks like if winswitch finds an Xpra socket that there's no session dir for, it attempts to claim it.
The socket and X process are being left behind because it was stopped stopped with SIGTERM, rather than xpra stop.

Xpra should be fixed to cleanup on SIGTERM so that X also gets killed.

For now, I've got a patch that'll make sure the dead socket gets removed when cleaning up the session dir so we don't end up with dead sessions.

Changed 4 years ago by Nathan Rennie-Waldock

comment:8 Changed 4 years ago by Antoine gmail

That's odd, where does the SIGTERM come from?
Xpra registers the same signal handler for SIGINT and SIGTERM, and I use SIGINT all the time.

In any case, I've merged your patch as I can't see any harm it would cause.
From what you're saying in comment:6, another workaround would be to set:

capture_external_sessions=False

in .winswitch/server/protocols/xpra.conf.

@nathan-renniewaldock, you should now have commit access using the same credentials as trac. (all your patches are very clean, and you seem to fix issues I failed to fix for years!)

@madmonk: does this fix things for you?

comment:9 Changed 4 years ago by Nathan Rennie-Waldock

The SIGTERM is from ServerSession.close(). On starting the server (xpra in this case), it adds its PID to the end of the kill on exit list.

Not sure why the socket is getting left behind then, it's correctly cleaned up on SIGINT.

My patch shouldn't cause any problems, the session is already about to be cleaned up at that point so it just makes sure the socket gets deleted too.

That'd work too, I completely missed that config file when I was looking. But this way it can stay on, some might like it to take externally started sessions.

Nice, thanks!

Note: See TracTickets for help on using tickets.