Checkbox raises an X Window System error when exiting after reporting a bug

Bug #430776 reported by Marc Tardif
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox
Fix Released
Medium
Marc Tardif

Bug Description

When running Checkbox and exiting, everything seems to work fine. However, when reporting one or more bugs in Checkbox and then exiting, the following error is displayed:

The program '--log-level=debug' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
  (Details: serial 4984 error_code 3 request_code 10 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.)

Revision history for this message
Marc Tardif (cr3) wrote :
Download full text (8.9 KiB)

After installing the necessary dbg packages (libglib2.0-0-dbg, libgtk2.0-0-dbg, libx11-6-dbg), I could generate the following stack trace after breaking at the gdk_x_error() function as instructed in the original error message:

#0 gdk_x_error (display=0x20bbf20, error=0x7fffff71cd20) at /build/buildd/gtk+2.0-2.16.1/gdk/x11/gdkmain-x11.c:613
No locals.
#1 0x00007f50f03165b4 in _XError (dpy=0x20bbf20, rep=0x22892b0) at ../../src/XlibInt.c:2931
        rtn_val = <value optimized out>
        event = {type = 0, xany = {type = 0, serial = 34324256, send_event = 14680102, display = 0x11a5, window = 33556995}, xkey = {type = 0, serial = 34324256, send_event = 14680102, display = 0x11a5,
    window = 33556995, root = 32, subwindow = 58358944, time = 139985577120026, x = 34774768, y = 0, x_root = -9319008, y_root = 32767, state = 34326944, keycode = 0, same_screen = 34327008}, xbutton = {
    type = 0, serial = 34324256, send_event = 14680102, display = 0x11a5, window = 33556995, root = 32, subwindow = 58358944, time = 139985577120026, x = 34774768, y = 0, x_root = -9319008, y_root = 32767,
    state = 34326944, button = 0, same_screen = 34327008}, xmotion = {type = 0, serial = 34324256, send_event = 14680102, display = 0x11a5, window = 33556995, root = 32, subwindow = 58358944,
    time = 139985577120026, x = 34774768, y = 0, x_root = -9319008, y_root = 32767, state = 34326944, is_hint = 0 '\0', same_screen = 34327008}, xcrossing = {type = 0, serial = 34324256, send_event = 14680102,
    display = 0x11a5, window = 33556995, root = 32, subwindow = 58358944, time = 139985577120026, x = 34774768, y = 0, x_root = -9319008, y_root = 32767, mode = 34326944, detail = 0, same_screen = 34327008,
    focus = 0, state = 34327004}, xfocus = {type = 0, serial = 34324256, send_event = 14680102, display = 0x11a5, window = 33556995, mode = 32, detail = 0}, xexpose = {type = 0, serial = 34324256,
    send_event = 14680102, display = 0x11a5, window = 33556995, x = 32, y = 0, width = 58358944, height = 0, count = -291958502}, xgraphicsexpose = {type = 0, serial = 34324256, send_event = 14680102,
    display = 0x11a5, drawable = 33556995, x = 32, y = 0, width = 58358944, height = 0, count = -291958502, major_code = 32592, minor_code = 34774768}, xnoexpose = {type = 0, serial = 34324256,
    send_event = 14680102, display = 0x11a5, drawable = 33556995, major_code = 32, minor_code = 0}, xvisibility = {type = 0, serial = 34324256, send_event = 14680102, display = 0x11a5, window = 33556995,
    state = 32}, xcreatewindow = {type = 0, serial = 34324256, send_event = 14680102, display = 0x11a5, parent = 33556995, window = 32, x = 58358944, y = 0, width = -291958502, height = 32592,
    border_width = 34774768, override_redirect = 0}, xdestroywindow = {type = 0, serial = 34324256, send_event = 14680102, display = 0x11a5, event = 33556995, window = 32}, xunmap = {type = 0,
    serial = 34324256, send_event = 14680102, display = 0x11a5, event = 33556995, window = 32, from_configure = 58358944}, xmap = {type = 0, serial = 34324256, send_event = 14680102, display = 0x11a5,
    event = 33556995, window = 32, override_redirect = 58358944}, xmaprequest = {type = 0, serial = 343242...

Read more...

Revision history for this message
Marc Tardif (cr3) wrote :

The above trace was not particularly useful, so further exploration pointed to this try block in the apport_prompt plugin:

        try:
            if symptom and hasattr(apport_interface, "run_symptom"):
                apport_interface.run_symptom()
            else:
                apport_interface.run_report_bug()
        except SystemExit, e:
            # In case of error, show_error already have been called
            pass

As detailed in the error message, the SystemExit exception should only ever be raised where e != 0. In other words, the run_symptom() or rum_report_bug() methods only raise that exception when there's an actual error. However, asserting the value of e showed that this exception was being caught when there was no error and e == 0.

The problem here is that the comment only really applies to the current process. However, a child process can be forked in order to open a url which is where the SystemExit exception is raised with a value of 0. The reason this presents a problem is that both the parent and child processes run in the Checkbox reactor which catches all exceptions, including SystemExit. In order for the child to break from the reactor, it must explicitly raise StopAllException. This seems to solve the problem.

Marc Tardif (cr3)
Changed in checkbox:
assignee: nobody → Marc Tardif (cr3)
importance: Undecided → Medium
milestone: none → 0.8-alpha6
status: New → Fix Committed
Marc Tardif (cr3)
Changed in checkbox:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.