Xpra: Ticket #209: Starting Xpra when blackbox is running crashes Xpra

Hello, I've tried starting a Xpra session but Blackbox was already running. What I do is:

xpra start
blackbox &

Sometimes, blackbox will manage to run, and xpra ends up not being able to start, failing with:

Gdk-ERROR **: The program 'xpra' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
  (Details: serial 244 error_code 10 request_code 2 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
aborting...


Tue, 08 Jan 2013 15:32:16 GMT - Antoine Martin: status changed

Cannot reproduce, please provide more details:

$ xpra start :10
$ DISPLAY=:10 blackbox
blackbox: another window manager is already running on display ':10'
blackbox: no managable screens found, exiting...

Wed, 30 Jan 2013 19:30:43 GMT - ahuillet:

You got this message because blackbox ran *after* Xpra had successfully started. I'm speaking of a case where the Xpra python process takes some time to register itself as a window manager, and therefore Blackbox manages to register before.

The program is not expected to work in that case - it can't since there already is a window manager. But in my opinion it should be displaying a nice error message, not what I've pasted!

Thanks


Mon, 11 Feb 2013 16:27:42 GMT - Antoine Martin: milestone changed


Wed, 27 Feb 2013 16:41:33 GMT - Antoine Martin: owner, status changed

Trying with:

xpra start :10 --no-daemon --start-child=blackbox
(..)
blackbox: another window manager is already running on display ':10'
blackbox: no managable screens found, exiting...

Blackbox cannot win this race with us..


But then:

xpra_Xdummy -dpi 96 -noreset -nolisten tcp \
    +extension GLX +extension RANDR +extension RENDER \
    -logfile ${HOME}/.xpra/Xorg.10.log -config /etc/xpra/xorg.conf :10 &
DISPLAY=:10 blackbox&
xpra start --use-display :10 --no-daemon
(..)
(Xpra:5960): Gdk-ERROR **: The program 'Xpra' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
  (Details: serial 269 error_code 10 request_code 2 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

Or in gdb:

(gdb) py-bt
#14 Frame 0xe17f20, for file /usr/lib64/python2.7/site-packages/wimpiggy/wm.py, line 211, in __init__ \
    for w in get_children(self._root):
#25 Frame 0xf63140, for file /usr/lib64/python2.7/site-packages/xpra/server.py, line 201, in x11_init \
    self._wm = Wm("Xpra", clobber)
#29 Frame 0xef2480, for file /usr/lib64/python2.7/site-packages/xpra/server_base.py, line 60, in __init__ \
    self.x11_init(clobber)
#37 Frame 0xef1f30, for file /usr/lib64/python2.7/site-packages/xpra/server.py, line 182, in __init__ \
    XpraServerBase.__init__(self, clobber, sockets, opts)
#48 Frame 0xbb5a60, for file /usr/lib64/python2.7/site-packages/xpra/scripts/server.py, line 439, in run_server
    app = XpraServer(clobber, sockets, opts)
#52 Frame 0x6ce380, for file /usr/lib64/python2.7/site-packages/xpra/scripts/main.py, line 375, in main
    return run_server(parser, options, mode, script_file, args)
#56 Frame 0x6cd000, for file /usr/bin/xpra, line 6, in <module> ()
    sys.exit(xpra.scripts.main.main(__file__, sys.argv))
(gdb) bt
#0  0x0000003da624ec67 in g_logv () from /lib64/libglib-2.0.so.0
#1  0x0000003da624ee32 in g_log () from /lib64/libglib-2.0.so.0
#2  0x00000031af26a2a8 in gdk_x_error () from /lib64/libgdk-x11-2.0.so.0
#3  0x0000003c33445556 in _XError \
    (dpy=dpy@entry=0xe57400, rep=rep@entry=0x10757b0) \
    at XlibInt.c:1583
#4  0x0000003c334427a1 in handle_error \
    (dpy=dpy@entry=0xe57400, err=err@entry=0x10757b0, in_XReply=in_XReply@entry=1) \
    at xcb_io.c:212
#5  0x0000003c334427e5 in handle_response \
    (dpy=dpy@entry=0xe57400, response=0x10757b0, in_XReply=in_XReply@entry=1) \
    at xcb_io.c:324
#6  0x0000003c334433d8 in _XReply \
    (dpy=dpy@entry=0xe57400, rep=rep@entry=0x7fffffffbda0, extra=extra@entry=0, discard=discard@entry=0) \
    at xcb_io.c:626
#7  0x0000003c33439886 in XQueryTree \
    (dpy=dpy@entry=0xe57400, w=68, root=root@entry=0x7fffffffbe28, parent=parent@entry=0x7fffffffbe30, children=children@entry=0x7fffffffbe38, nchildren=nchildren@entry=0x7fffffffbe24) \
    at QuTree.c:46
#8  0x00007fffeb0d4a3e in __pyx_pf_8wimpiggy_8lowlevel_8bindings_38_query_tree \
    (__pyx_v_pywindow=<gtk.gdk.Window at remote 0xff1cd0>, __pyx_self=<optimized out>) \
    at wimpiggy/lowlevel/bindings.c:6713
#9  __pyx_pw_8wimpiggy_8lowlevel_8bindings_39_query_tree \
    (__pyx_self=<optimized out>, __pyx_v_pywindow=<gtk.gdk.Window at remote 0xff1cd0>) \
    at wimpiggy/lowlevel/bindings.c:6610
#10 0x000000325fe49c0e in PyObject_Call \
    (func=func@entry=<built-in function _query_tree>, arg=arg@entry=(<gtk.gdk.Window at remote 0xff1cd0>,), kw=kw@entry=0x0) \
    at /usr/src/debug/Python-2.7.3/Objects/abstract.c:2529
#11 0x00007fffeb0aafab in __pyx_pf_8wimpiggy_8lowlevel_8bindings_40get_children \
    (__pyx_self=<optimized out>, __pyx_v_pywindow=<gtk.gdk.Window at remote 0xff1cd0>) \
    at wimpiggy/lowlevel/bindings.c:6967
#12 __pyx_pw_8wimpiggy_8lowlevel_8bindings_41get_children \
    (__pyx_self=<optimized out>, __pyx_v_pywindow=<gtk.gdk.Window at remote 0xff1cd0>) \
    at wimpiggy/lowlevel/bindings.c:6925
#13 0x000000325fedd1e3 in call_function \
    (oparg=<optimized out>, pp_stack=0x7fffffffc098) \
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:4086
#14 PyEval_EvalFrameEx (f=f@entry=
    Frame 0xe17f20, for file /usr/lib64/python2.7/site-packages/wimpiggy/wm.py, line 211, in __init__

This is a few dozen lines after this check:

        # Become the Official Window Manager of this year's display:
        self._wm_selection = wimpiggy.selection.ManagerSelection(self._display, "WM_S0")
        self._wm_selection.connect("selection-lost", self._lost_wm_selection)

So we should check harder, and if blackbox refuses to exit (as it should), then we should exit with an error.


Thu, 28 Feb 2013 07:56:47 GMT - Antoine Martin: status changed; resolution set

Fixed in r2841 (see changeset for more info)

blackbox does not set "WM_S0" (as it should I believe), but it does set _NET_SUPPORTING_WM_CHECK. In all cases, we now warn if we find an existing window manager, and in this particular case, we just refuse to run since we cannot take over:

Warning: found an existing window manager on screen 0 using window id 0x200029L: Blackbox
it does not own the selection 'WM_S0' so we cannot take over and make it exit
please stop Blackbox so you can run xpra on this display

Sat, 23 Jan 2021 04:48:29 GMT - migration script:

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