Xpra: Ticket #979: Server startup crash with dict/typedict mismatch

Three server crashes related to starting xpra like this:

XPRA_ALLOW_ALPHA=0 xpra start :101 --no-daemon --start-child=/usr/bin/gnome-terminal --no-mdns --no-speaker --no-microphone --no-pulseaudio

  1. A definition of sound_option_or_all() is required when speaker/microphone is turned off:
2015-09-07 02:47:44,183 Error: cannot start the xpra server
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/xpra/scripts/server.py", line 966, in run_server
    app.init(opts)
  File "/usr/lib64/python2.6/site-packages/xpra/x11/server.py", line 181, in init
    X11ServerBase.init(self, opts)
  File "/usr/lib64/python2.6/site-packages/xpra/x11/x11_server_base.py", line 74, in init
    GTKServerBase.init(self, opts)
  File "/usr/lib64/python2.6/site-packages/xpra/server/server_base.py", line 231, in init
    self.init_sound_options(opts)
  File "/usr/lib64/python2.6/site-packages/xpra/server/server_base.py", line 411, in init_sound_options
    self.speaker_codecs = sound_option_or_all("speaker-codec", opts.speaker_codec, encoders)
UnboundLocalError: local variable 'sound_option_or_all' referenced before assignment
2015-09-07 02:47:44,184 local variable 'sound_option_or_all' referenced before assignment

i.e.

        if self.supports_speaker or self.supports_microphone:
            try:
                from xpra.sound.gstreamer_util import sound_option_or_all
                from xpra.sound.wrapper import query_sound
                self.sound_properties = query_sound()
            except Exception as e:
                soundlog.error("Error: failed to query sound subsystem:")
                soundlog.error(" %s", e)
                def sound_option_or_all(*args):
                    return []
        else:
            def sound_option_or_all(*args):
                return []
        self.sound_source_plugin = opts.sound_source
  1. wrapper.py::query_sound() should return typedict() when returncode!=0, rather than {}
    if proc.returncode!=0:
        return typedict()
  1. Initialisation of sound_properties in ServerBase?.init() should be a typedict() rather than {}

2 & 3 stop this crash:

2015-09-07 02:42:18,065 error parsing child environment: 'tuple' object has no attribute 'split'
2015-09-07 02:42:18,066 Error: cannot start the xpra server
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/xpra/scripts/server.py", line 966, in run_server
    app.init(opts)
  File "/usr/lib64/python2.6/site-packages/xpra/x11/server.py", line 181, in init
    X11ServerBase.init(self, opts)
  File "/usr/lib64/python2.6/site-packages/xpra/x11/x11_server_base.py", line 74, in init
    GTKServerBase.init(self, opts)
  File "/usr/lib64/python2.6/site-packages/xpra/server/server_base.py", line 231, in init
    self.init_sound_options(opts)
  File "/usr/lib64/python2.6/site-packages/xpra/server/server_base.py", line 409, in init_sound_options
    encoders = self.sound_properties.strlistget("encoders", [])
AttributeError: 'dict' object has no attribute 'strlistget'
2015-09-07 02:42:18,067 '


Mon, 07 Sep 2015 10:04:00 GMT - Antoine Martin: owner changed

@nickb: why the XPRA_ALLOW_ALPHA=0? This does not do anything at all.


A definition of sound_option_or_all() is required when speaker/microphone is turned off...


When both are turned off. Good catch.


should return typedict() when returncode


Oops.

Does r10541 work for you? If so, please close this ticket. Thanks!


Thu, 10 Sep 2015 15:54:14 GMT - Antoine Martin: status changed; resolution set


Sat, 23 Jan 2021 05:11:28 GMT - migration script:

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