xpra icon
Bug tracker and wiki

Opened 4 years ago

Closed 4 years ago

#979 closed defect (fixed)

Server startup crash with dict/typedict mismatch

Reported by: Nick Burrett Owned by: Nick Burrett
Priority: major Milestone: 0.16
Component: server Version: trunk
Keywords: Cc:

Description

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 '

Change History (2)

comment:1 Changed 4 years ago by Antoine Martin

Owner: changed from Antoine Martin to Nick Burrett

@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!

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

comment:2 Changed 4 years ago by Antoine Martin

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.