** Description changed:
+ [ Impact ]
+
+ Bug Description:
+
+ gnome-shell crashes with SIGSEGV in meta_compositor_sync_stack()
+ (compositor.c:773), ending the user's session and losing unsaved work in
+ every open application. Reporters hit it a few seconds after an idle screen
+ lock, several times a month, on Noble with X11 clients running (Wayland with
+ Xwayland, and Xorg).
+
+ Root Cause:
+
+ In src/core/frame.c, meta_window_x11_set_frame_xwindow() ignores a failure
+ of XReparentWindow(client, frame) ("FIXME handle this error") and keeps the
+ frame's XID registered to the window. Both XIDs then resolve to the same
+ MetaWindow, so its actor is added to the compositor's window list twice.
+ When the window is destroyed only one entry is removed, and the next stack
+ sync dereferences the leftover actor's NULL MetaWindow.
+
+ Fix:
+
+ Four upstream commits from mutter 46.3 (gnome-46 MR !3785, backport of main
+ MR !3732). They check for X errors during frame setup, including the
+ reparent. On failure, mutter unregisters the frame's XID, then frees the frame
+ and returns without changing the window's state, so the window cannot be
+ listed twice. The change is in one function in one file.
+
+ [ Test Plan ]
+
+ Reproducer Contents:
+
+ x11-parentrel.py is a small python3-xlib X11 client that acts as the trigger.
+ run-installed.sh prints the installed mutter version, then runs the trigger
+ N times, each time in a fresh GDM autologin session, and reports whether
+ gnome-shell crashed (both are in lp2169912-reproducer.tar.gz.)
+
+ How the Test Works:
+
+ x11-parentrel.py creates 20 depth-24 X11 windows whose background is set to
+ ParentRelative. X11 does not allow a ParentRelative window to be reparented
+ into a parent of a different depth, and mutter's frames are depth-32 ARGB
+ windows, so mutter's XReparentWindow() of each client into its frame fails
+ with BadMatch every time. This is the same failed-reparent condition behind
+ the crash in the field. The script keeps the windows alive for 3 seconds,
+ while client and frame both exist and the duplicate stack entry is present.
+ It then checks each window's parent and prints how many are still children
+ of the root window, which confirms that the reparent failed (this should be
+ 20/20 with any package). Finally it destroys the windows one at a time. With
+ the current package this leaves a stale entry in the compositor's window
+ list, and the next stack sync crashes gnome-shell.
+
+ run-installed.sh waits for the VM to finish booting, keeps full core dumps
+ (kernel.core_pattern set to /var/coredumps/core.%e.%p.%t, and
+ LimitCORE=infinity for [email protected]), and starts
+ gnome-shell with MUTTER_DEBUG=window-state so mutter's frame-setup messages
+ reach the journal. A trial is reported as CRASHED if the journal shows
+ "GNOME Shell crashed" for that gnome-shell PID or the PID is gone, and as
+ FAIL if gnome-shell was not running or the trigger could not run, so a test
+ that did not run cannot be mistaken for a pass. Because the reparent fails
+ every time, the result does not depend on timing.
+
+ Steps:
+
+ On any amd64 host with LXD, extract the reproducer tarball into an empty
+ directory, create a Noble VM and install a minimal desktop with GDM
+ autologin:
+
+ tar xzf lp2169912-reproducer.tar.gz
+ lxc launch ubuntu:24.04 lp2169912 --vm -c limits.cpu=4 -c
limits.memory=6GiB -d root,size=40GiB
+ lxc file push run-installed.sh lp2169912/root/ --mode 0755
+ lxc file push x11-parentrel.py lp2169912/home/ubuntu/ --uid 1000 --gid 1000
--mode 0755
+ lxc shell lp2169912
+
+ apt-get update
+ apt-get install -y ubuntu-desktop-minimal python3-xlib gdb
+ printf
'[daemon]\nWaylandEnable=true\nAutomaticLoginEnable=true\nAutomaticLogin=ubuntu\n'
> /etc/gdm3/custom.conf
+ systemctl restart gdm
+
+ For a symbolized backtrace, install libmutter-14-0-dbgsym at the same
+ version as the installed libmutter-14-0:
+
+ lxc file push libmutter-14-0-dbgsym_46.2-1ubuntu0.24.04.18_amd64.ddeb
lp2169912/root/
+ lxc exec lp2169912 -- dpkg -i
/root/libmutter-14-0-dbgsym_46.2-1ubuntu0.24.04.18_amd64.ddeb
+
+ The .ddeb can be downloaded with pull-lp-ddebs from ubuntu-dev-tools, for
+ example "pull-lp-ddebs -a amd64 mutter 46.2-1ubuntu0.24.04.18".
+
+ To show the bug, run the test against the current noble-updates package
+ (46.2-1ubuntu0.24.04.18):
+
+ /root/run-installed.sh 10
+
+ To verify the fix, enable noble-proposed, upgrade the mutter packages,
+ and run the same command again:
+
+ apt-get install -y -t noble-proposed libmutter-14-0 mutter-common
mutter-common-bin gir1.2-mutter-14
+ /root/run-installed.sh 10
+
+ Expected results: with the current package every trial is CRASHED. With the
+ fixed package every trial survives, and each trial log shows mutter
+ rejecting the frames ("WINDOW_STATE: Failed to set <xid> as <window> frame").
+ In both cases x11-parentrel.py reports 20/20 windows not reparented into a
+ frame. With the fixed package the test windows are left without decorations,
+ which is expected because they cannot be framed.
+
+ Log Locations:
+
+ Every trial writes /root/repro-logs/<version>-trial-<N>.log inside the VM.
+ The log contains the trigger's output, the journal lines for that
+ gnome-shell PID ("GNOME Shell crashed with signal 11", "Main process exited,
+ code=dumped, status=11/SEGV"), and the number of "Failed to set ... frame"
+ messages mutter logged. For a crashed trial it also has a gdb backtrace of
+ the core, the value of old_window, the type of the stale actor and its
+ private state. The summary printed at the end is saved to
+ /root/repro-logs/summary-<version>.txt. The trial logs, not the summary, are
+ the evidence.
+
+ Results Obtained Before Upload:
+
+ The test was run on a Noble VM (gnome-shell 46.0-0ubuntu6~24.04.17,
+ xwayland 2:23.2.6-1ubuntu0.8) against the current package and against the
+ same package built in a PPA with the four upstream patches applied.
+
+ 46.2-1ubuntu0.24.04.18: 10/10 crashed, 0/10 failed to run
+ 46.2-1ubuntu0.24.04.18+ppa: 0/10 crashed, 0/10 failed to run
+
+ In every trial with both packages, x11-parentrel.py reported 20/20 windows
+ not reparented into a frame. With the PPA package, mutter logged "Failed to
+ set ... frame" in every trial (three attempts for each of the 20 frames, each
+ rejected), confirming the new error path is the one that runs.
+
+ This is the gdb output from the first crashed trial with the current
+ package, with libmutter-14-0-dbgsym installed. Frames #0-#5 are gnome-shell's
+ crash handler re-raising the signal:
+
+ #5 <signal handler called>
+ #6 meta_compositor_sync_stack (stack=0x5b28472974a0,
compositor=0x5b28453398f0) at ../src/compositor/compositor.c:773
+ #7 meta_stack_tracker_sync_stack (tracker=0x5b284532c600) at
../src/core/stack-tracker.c:1079
+ #8 stack_tracker_sync_stack_later (data=0x5b284532c600) at
../src/core/stack-tracker.c:1089
+ #9 0x00007ff8674ab988 in meta_later_invoke (later=0x5b2847cea760) at
../src/compositor/meta-later.c:122
+ #10 run_repaint_laters (laters_list=0x5b28453263e0) at
../src/compositor/meta-later.c:168
+ #11 on_before_update (stage=0x5b284351e4b0,
stage_view=stage_view@entry=0x5b28452e97b0, frame=frame@entry=0x5b2846c153a0,
laters=0x5b28453263a0) at ../src/compositor/meta-later.c:186
+
+ (gdb) frame function meta_compositor_sync_stack
+ (gdb) print old_window
+ $1 = (MetaWindow *) 0x0
+ (gdb) print ((GObjectClass *) ((GTypeInstance *)
old_actor)->g_class)->dispose
+ $2 = (void (*)(GObject *)) 0x7ff86750c480 <meta_window_actor_x11_dispose>
+ (gdb) print *(MetaWindowActorPrivate *) ((char *) old_actor +
MetaWindowActor_private_offset)
+ $3 = {window = 0x0, compositor = 0x5b28453398f0, stage_views_changed_id =
0, surface = 0x0, surface_actors = 0x0, geometry_scale = 1,
minimize_in_progress = 0, unminimize_in_progress = 0, size_change_in_progress =
0, map_in_progress = 0, destroy_in_progress = 0, freeze_count = 0,
screen_cast_usage_count = 0, visible = 0, disposed = 1, needs_destroy = 1,
updates_frozen = 0, first_frame_state = 1}
+
+ This is the same call chain and the same state as in the reporters' crash,
+ a disposed MetaWindowActorX11 still in the compositor's window list, with
+ window = NULL, surface = NULL, disposed = 1 and needs_destroy = 1.
+
+ [ Where problems could occur ]
+
+ All changes are in the code that adds and removes frames on X11 windows,
+ which runs for every X11 application in an Xorg session and every Xwayland
+ application in a Wayland session. The following should be considered:
+
+ - A wrongly triggered error path would leave X11 windows without
+ decorations (no title bar or border, so they cannot be moved or resized
+ that way)
+ - The reparent now happens before the map/unmap bookkeeping. A mistake
+ there would make new X11 windows disappear or fail to map, or make
+ hidden windows stay on screen
+ - The frame is now freed automatically (g_autoptr with the new
+ meta_frame_free()). A mistake there would cause a use-after-free or
+ double free, crashing gnome-shell when X11 windows close or toggle
+ decorations
+ - Each frame setup can now need up to two extra X server round trips
+ (XSync), which a busy or slow X server would show as brief delays when
+ X11 windows open
+ - In testing, the mutter-x11-frames helper asked mutter to map the same
+ rejected frame three times. A mistake here would show up as stray or
+ empty frame windows, or as the helper and mutter repeatedly retrying
+ the same frame
+
+ [ Other Info ]
+
+ Upstream:
+
+ bcc209bf73a7cae9f57a0c18973a26223f69cb48 frame: Define a free function for
MetaFrame and use via autoptr
+ bd799b6b3600d8598809057d705fcece7b7bec6e frame: Associate the frame to the
window after reparenting
+ 1e02c06298ce8ec9d476570fd18904e3f2176001 frame: Handle reparent failure
avoiding duplicate stack windows instances
+ 24e6843ab7b9fff9fbba3956e421f5202e251050 frame: Handle X11 errors earlier on
frame setting
+
+ They sit directly on top of the 46.2 tag and are in every mutter release
+ since 46.3, so all Ubuntu releases after Noble already have the fix. The
+ gnome-46 branch has had no follow-up fixes to src/core/frame.c since 46.3.
+ The commits apply unchanged to the Noble source, and with the full Ubuntu
+ patch series applied, src/core/frame.c is identical to upstream 24e6843a.
+
+ Why All Four Commits:
+
+ The original description named only 24e6843a, the last commit of the
+ series. The actual fix is 1e02c062. bcc209bf and bd799b6b are required for
+ 1e02c062 to apply, and so that its early return does not leak the frame,
+ leave window->frame pointing to an unregistered frame, or leave a pending
+ unmap that never arrives. 24e6843a applies the same check to X errors
+ earlier in frame setup. The reproducer does not exercise that path. It is
+ included because it is part of the same 9-line-or-smaller upstream series
+ and depends on the other three.
+
+ Not Included:
+
+ c202662c ("stack-tracker: Improve logging when an operation is ignored")
+ from main MR !3732 only adds debug logging and is not in 46.3. It is the
+ source of the "NO_RESTACK_X_WINDOWS" message mentioned in the original
+ description.
+
+ [ Original Bug Description ]
+
gnome-shell (Wayland session) repeatedly crashes with SIGSEGV in
meta_compositor_sync_stack(). The crash ends the whole user session:
all applications are closed and unsaved work is lost.
The crash matches an upstream bug that was fixed in mutter 46.3, but the
fix is not in noble's mutter 46.2-1ubuntu0.24.04.x. Please consider
backporting it in an SRU.
== Environment ==
Ubuntu 24.04 (noble), amd64, GNOME on Wayland
gnome-shell 46.0-0ubuntu6~24.04.14 and ~24.04.15
libmutter-14-0 46.2-1ubuntu0.24.04.16
xwayland 2:23.2.6-1ubuntu0.8
Kernels 7.0.0-31, -34 and -38-generic (crashed on all three)
GPU Intel Tiger Lake (i915), internal eDP-1 + external HDMI-A-1
Extensions ubuntu-dock, ubuntu-appindicators. The crash also happened
- with tiling-assistant and desktop-icons-ng disabled.
+ with tiling-assistant and desktop-icons-ng disabled.
== Occurrences (identical signature every time) ==
2026-09-22 17:30, 2026-09-30 11:57, 2026-10-07 11:53, 2026-10-07 17:29
- gnome-shell[4070]: segfault at 29e ip 00007399faee4935 sp 00007ffd7e7dbcd0
- error 4 in libmutter-14.so.0.0.0[e4935,7399fae50000+167000]
+ gnome-shell[4070]: segfault at 29e ip 00007399faee4935 sp 00007ffd7e7dbcd0
+ error 4 in libmutter-14.so.0.0.0[e4935,7399fae50000+167000]
== Backtrace ==
Symbolized with libmutter-14-0-dbgsym 46.2-1ubuntu0.24.04.16
(build-id 9e23feb34618e83d573bf082ab3964e525c91051, matches the
installed library):
#0 meta_compositor_sync_stack (stack=0x0, compositor=0x60f141b649a0)
- at ../src/compositor/compositor.c:773
+ at ../src/compositor/compositor.c:773
#1 meta_stack_tracker_sync_stack (tracker=0x60f141b57560)
- at ../src/core/stack-tracker.c:1079
+ at ../src/core/stack-tracker.c:1079
#2 stack_tracker_sync_stack_later (data=0x60f141b57560)
- at ../src/core/stack-tracker.c:1089
+ at ../src/core/stack-tracker.c:1089
#3 meta_later_invoke (later=0x60f146dd1ea0)
- at ../src/compositor/meta-later.c:122
+ at ../src/compositor/meta-later.c:122
#4 run_repaint_laters (laters_list=0x60f141b64e20)
- at ../src/compositor/meta-later.c:168
+ at ../src/compositor/meta-later.c:168
#5 on_before_update (stage=0x60f141af7080, ...)
- at ../src/compositor/meta-later.c:186
+ at ../src/compositor/meta-later.c:186
#6 _clutter_marshal_VOID__OBJECT_BOXEDv (...)
- at clutter/clutter/clutter-marshal.c:1931
+ at clutter/clutter/clutter-marshal.c:1931
#7 g_signal_emit_valist / g_signal_emit (libgobject-2.0)
...
#11 meta_context_run_main_loop ()
compositor.c:773 is:
- if ((old_window->hidden || old_window->unmanaging) &&
+ if ((old_window->hidden || old_window->unmanaging) &&
State at the time of the crash:
- old_window = 0x0
- old_actor = 0x60f1462cb2e0, a MetaWindowActorX11
- (class vfuncs: meta_window_actor_x11_dispose, ...)
- MetaWindowActorPrivate of old_actor:
- window = 0x0, surface = 0x0, disposed = 1, needs_destroy = 1
+ old_window = 0x0
+ old_actor = 0x60f1462cb2e0, a MetaWindowActorX11
+ (class vfuncs: meta_window_actor_x11_dispose, ...)
+ MetaWindowActorPrivate of old_actor:
+ window = 0x0, surface = 0x0, disposed = 1, needs_destroy = 1
The compositor's window list still holds an X11 (Xwayland) window actor
that has already been disposed. The next stack sync dereferences its
NULL MetaWindow (offset 0x29e is old_window->hidden).
== Upstream fix ==
This is the failure mode described in mutter MR !3732, "frame: Handle
reparent failure avoiding duplicate stack windows instances". A failed
frame reparent leaves a duplicate entry in the stack, so the window is
added to the compositor's list twice, and only one entry is removed when
the window is destroyed.
- main: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3732
- (merged 2024-05-27)
+ (merged 2024-05-27)
- gnome-46: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3785
- commit 24e6843ab7b9fff9fbba3956e421f5202e251050,
- first released in mutter 46.3
+ commit 24e6843ab7b9fff9fbba3956e421f5202e251050,
+ first released in mutter 46.3
The installed libmutter-14.so.0 (46.2-1ubuntu0.24.04.16) does not contain
this fix. The strings added by the fix ("Setting up frame for window %s
failed", "Failed to set %lu as %s frame", "Ignoring addition of %s as
per NO_RESTACK_X_WINDOWS") are not in the binary, while "Incrementing
unmaps_pending on %s for reparent", which exists both before and after
the fix, is present. The changelogs of 46.2-1ubuntu0.24.04.17 and .18 do
not mention it either.
== When it happens ==
Every crash happened while I was away from the desk, about 1-3 seconds
after the screen locked on idle (idle-delay 300, lock enabled, external
HDMI monitor). The timing is inferred from journal entries that are
logged at each screen lock on this machine.
X11 clients normally running on this machine:
- teams-for-linux (snap; its launcher forces --ozone-platform=x11)
- VS Code (snap, runs through Xwayland)
The screen locks several times a day, but only 4 locks in about three
weeks ended in a crash, which looks like a race. It cannot be reproduced
on demand.
== Additional information ==
The apport crash file (/var/crash/_usr_bin_gnome-shell.1000.crash) with
a core dump exists locally. I have not attached it because it contains a
full memory dump of the session. I can provide more details or run
additional commands on request.
** Attachment added: "lp2169912-reproducer.tar.gz"
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2169912/+attachment/6017782/+files/lp2169912-reproducer.tar.gz
--
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to mutter in Ubuntu.
https://bugs.launchpad.net/bugs/2169912
Title:
gnome-shell crashed with SIGSEGV in meta_compositor_sync_stack() -
please backport mutter fix 24e6843a (46.3) to noble
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2169912/+subscriptions
--
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs