Mutter (X11 window+compositing manager) fails to switch between workspaces
Affected versions
This affects Mutter version 41.1 on Debian testing, and version 3.38.6 on Raspberry Pi OS bullseye. See detailed version information below. I both cases, X is used. Mutter is used as the window manager.
Bug summary
During an attempt to switch workspace, we get stuck in between two workspaces. Some parts of the current workspace vanish, but other parts remain visible. Based on mouse pointer changes, something of the destination workspace is also present.
On its terminal output, Mutter writes GLib-GObject-WARNING: invalid (NULL) pointer instance
and a GLib-GObject-CRITICAL: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
. Having tracked that down in GDB, this happens at https://gitlab.gnome.org/GNOME/mutter/-/blob/62ab4c09d9badad00d81178e1af818c7222e0597/src/compositor/plugins/default.c#L582, when switch_workspace
tries to attach a callback to a Clutter timeline.
Steps to reproduce
- Use mutter are the window manager (if not already):
mutter --replace
- Switch workspace (using a workspace switcher widget or using a key combination)
- Observe weirdness.
- Escape to a terminal to recover by replacing mutter with a new instance:
DISPLAY=:0 mutter --replace
What happened
We got stuck in a limbo space between workspaces.
What did you expect to happen
We successfully switched workspaces, and the target workspace functioned properly.
Relevant logs, screenshots, screencasts etc.
Screen recording from Debian attached: screenrec.mkv.
- This starts on workspace 1, where we launch mutter, and schedule two more mutter takeovers in 10s and 20s.
- Clicking on workspace 2 in the workspace widget, the menu bar vanishes and it appears we stay on workspace 1. However, the mouse pointer seems to detect an edge where none should be.
- When the 10s timer expires, and a new mutter instance takes over, we make it to workspace 2.
- We get back to workspace 1 in the same way as we got to workspace 2. On workspace 1, error messages have appeared in the xterms running mutter.
Analysis
My analysis is that workspace_switch
in src/compositor/plugins/default
attempts to animate a no-op change. Because this is a no-op, no transition is created. Because of that, the callback to continue regular operation after the animation fails to get attached, and doesn't get called.
To be precise, the 'animation' is workspace0
getting scaled from 1.0 to 1.0 [1,2] and workspace1
from 0.0 to 0.0 [3,4]. These are both no-op scale changes. Hence no transitions get allocated [5]. Hence NULL
timelines get returned [6,7]. This
causes the completion callback to never get called [8], taking us to a limbo state.
[1] https://gitlab.gnome.org/GNOME/mutter/-/blob/62ab4c09d9badad00d81178e1af818c7222e0597/clutter/clutter/clutter-actor.c#L4274
[2] https://gitlab.gnome.org/GNOME/mutter/-/blob/62ab4c09d9badad00d81178e1af818c7222e0597/src/compositor/plugins/default.c#L577-581
[3] https://gitlab.gnome.org/GNOME/mutter/-/blob/62ab4c09d9badad00d81178e1af818c7222e0597/src/compositor/plugins/default.c#L523
[4] https://gitlab.gnome.org/GNOME/mutter/-/blob/62ab4c09d9badad00d81178e1af818c7222e0597/src/compositor/plugins/default.c#L587-591
[5] https://gitlab.gnome.org/GNOME/mutter/-/blob/62ab4c09d9badad00d81178e1af818c7222e0597/clutter/clutter/clutter-actor.c#L4728-4729
[6] https://gitlab.gnome.org/GNOME/mutter/-/blob/62ab4c09d9badad00d81178e1af818c7222e0597/src/compositor/plugins/default.c#L315
[7] https://gitlab.gnome.org/GNOME/mutter/-/blob/62ab4c09d9badad00d81178e1af818c7222e0597/clutter/clutter/clutter-timeline.h#L36
[8] https://gitlab.gnome.org/GNOME/mutter/-/blob/62ab4c09d9badad00d81178e1af818c7222e0597/src/compositor/plugins/default.c#L582-585
More detailed version information
On Debian testing, 41.1:
$ dpkg -l '*mutter*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==================-============-============-===========================================================
un libmutter-6-0 <none> <none> (no description available)
un libmutter-7-0 <none> <none> (no description available)
ii libmutter-9-0:i386 41.1-1 i386 window manager library from the Mutter window manager
ii mutter 41.1-1 i386 Example window manager using GNOME's window manager library
ii mutter-common 41.1-1 all shared files for the Mutter window manager
$ uname -a
Linux zeta 5.14.0-4-686-pae #1 SMP Debian 5.14.16-1 (2021-11-03) i686 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux bookworm/sid
Release: testing
Codename: bookworm
On Raspberry Pi OS, 3.38.6:
pi@theta:~/code/mutter-deb $ dpkg -l '*mutter*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===================-=======================-============-========================================================>
ii libmutter-7-0:arm64 1:3.38.6-2~deb11u1+rpt1 arm64 window manager library from the Mutter window manager
ii mutter 1:3.38.6-2~deb11u1+rpt1 arm64 Example window manager using GNOME's window manager libr>
ii mutter-common 1:3.38.6-2~deb11u1+rpt1 all shared files for the Mutter window manager
pi@theta:~ $ uname -a
Linux theta 5.10.63-v8+ #1459 SMP PREEMPT Wed Oct 6 16:42:49 BST 2021 aarch64 GNU/Linux
pi@theta:~ $ lsb_release --all
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye