After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 789242 - Gnome-shell aborts with X error BadWindow if a window is created and quickly destroyed
Gnome-shell aborts with X error BadWindow if a window is created and quickly ...
Status: RESOLVED DUPLICATE of bug 788666
Product: gnome-shell
Classification: Core
Component: general
3.26.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2017-10-20 11:56 UTC by Michal Srb
Modified: 2017-10-20 12:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A simplified reproducer. (754 bytes, text/x-csrc)
2017-10-20 11:56 UTC, Michal Srb
Details

Description Michal Srb 2017-10-20 11:56:23 UTC
Created attachment 361933 [details]
A simplified reproducer.

This problem was originally reported downstream here:
https://bugzilla.opensuse.org/show_bug.cgi?id=1062904

Starting `qemu-system-x86_64 -display sdl` crashes gnome-shell. It can be also reproduced with a simplified program (attached).

It was observed in version 3.26.1, not sure about newer ones, but there is no obvious fix in git log.

Gnome-shell terminates with error:
  The program 'gnome-shell' received an X Window System error.
  This probably reflects a bug in the program.
  The error was 'BadWindow (invalid Window parameter)'.
    (Details: serial 9274 error_code 3 request_code 18 (core protocol) 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 GDK_SYNCHRONIZE environment
    variable to change this behavior. You can then get a meaningful
    backtrace from your debugger if you break on the gdk_x_error() function.)

If you run gnome-shell with GDK_SYNCHRONIZE set, it does not crash. (It is most likely timing sensitive, see later.)

The request_code 18 is ChangeProperty request. I have recorded the X11 communication and observed this happening:

* qemu creates window
* gnome-shell queries and sets various properties on it
* qemu destroys window
* gnome-shell attempts to set two properties:
   * _NET_WM_STATE = _NET_WM_STATE_FOCUSED
   * _GTK_EDGE_CONSTRAINTS = 0xaa
* gnome-shell receives BadWindow error and aborts

I think that the race between setting window properties and window being destroyed by another application is unavoidable. Gnome-shell should handle the BadWindow error gracefully instead of aborting. For example kwin reacts to the same situation by printing error to log and continuing.
Comment 1 Rui Matos 2017-10-20 12:18:13 UTC

*** This bug has been marked as a duplicate of bug 788666 ***