GNOME Bugzilla – Bug 790207
Crash after switching monitor off and on under X
Last modified: 2021-07-05 13:45:42 UTC
This seems to be very similar to bug #788764 but on X.org. Whenever I switch my monitor (Dell P2415Q with scaling-factor=2) off and on again due to suspend or locking the screen, there is a chance that mutter/gnome-shell crashes. I have the following lines in my log: gnome-shell[1415]: meta_monitor_manager_get_logical_monitor_from_number: assertion '(unsigned int) number < g_list_length (manager->logical_monitors)' failed gnome-shell[1415]: meta_workspace_get_work_area_for_monitor: assertion 'logical_monitor != NULL' failed This then results in a crash: Stack trace of thread 1415: #0 0x00007efe607b2b8c meta_window_move_resize_request (libmutter-1.so.0) #1 0x00007efe607b3a43 meta_window_x11_configure_request (libmutter-1.so.0) #2 0x00007efe607a880d handle_other_xevent (libmutter-1.so.0) #3 0x00007efe607a973b xevent_filter (libmutter-1.so.0) #4 0x00007efe5f9f6a7f gdk_event_apply_filters (libgdk-3.so.0) #5 0x00007efe5f9f6d69 _gdk_x11_display_queue_events (libgdk-3.so.0) #6 0x00007efe5f9c0820 gdk_display_get_event (libgdk-3.so.0) #7 0x00007efe5f9f6b12 gdk_event_source_dispatch (libgdk-3.so.0) #8 0x00007efe6226ebb7 g_main_context_dispatch (libglib-2.0.so.0) #9 0x00007efe6226ef60 g_main_context_iterate.isra.25 (libglib-2.0.so.0) #10 0x00007efe6226f272 g_main_loop_run (libglib-2.0.so.0) #11 0x00007efe607894fc meta_run (libmutter-1.so.0) #12 0x000055dc004c342c main (gnome-shell) #13 0x00007efe6010203a __libc_start_main (libc.so.6) #14 0x000055dc004c356a _start (gnome-shell) (Sorry, I do not have a better backtrace than that.)
What version of mutter and gnome-shell (including distro package version) do you have?
(In reply to Jonas Ådahl from comment #1) > What version of mutter and gnome-shell (including distro package version) do > you have? Oh, sorry, completely forgot to include that: mutter.x86_64 3.26.2-1.fc27 gnome-shell.x86_64 3.26.2-1.fc27
Small update: This still happens with the latest updates. mutter.x86_64 3.26.2-2.fc27 (up to commit cde545462) gnome-shell.x86_64 3.26.2-3.fc27
I get this bug too but in it happens in both X and Wayland. It happens when there is only one monitor attached to the system (via HDMI in my case) and I turn it off or disconnect it. It's a regression in gnome-shell/mutter that occurred in Ubuntu some time in August 2017. Obviously it's a critical bug if you only have one monitor and it can be turned off, because gnome-shell completely crashes, losing any unsaved data. It's currently happening for me with gnome-shell 3.26.2-0ubuntu2 and mutter 3.26.2-1. It looks like the same bug as https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1726352 (with the x11 stack trace) and https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1742598 (with a dump when running under Wayland).
As discussed in https://bugzilla.gnome.org/show_bug.cgi?id=789501#c19, I also got hit by this using an RX-560 and a Dell P2715Q monitor on FC27, with either Xorg or Wayland. The package in use is the current latest `mutter-3.26.2-2` . I was able to work around this issue by building a custom mutter rpm for myself using the patch in the above issue: https://bugzilla.gnome.org/attachment.cgi?id=362301&action=diff) to get me going, because gnome-shell was consistently crashing whenever I locked or powered-off my screen, so the situation was rather desperate. I guess the FC27 package (https://bodhi.fedoraproject.org/updates/FEDORA-2017-39b370bebf) needs to be updated; I have created a gist with instructions for anyone interested building their own in the meantime.
Does cherry-picking/checking out the 6dcce19932 commit fix the issue?
@Jonas: I tried applying the patch in commit 6dcce19932 to ubuntu's mutter-3.26.2-1 and yes, it fixes the problem for me.
I should clarify that the fix works only when I run gnome-shell in X11, not in Wayland, which should probably be obvious since it's a patch to a file in src/x11. I'll see if the check on connector->count_modes helps in Wayland from comment #5.
The check on connector->count modes didn't help: Wayland still crashes when I turn off my only monitor. Although gnome-shell doesn't crash running in X now when I turn the monitor off, there are still some issues: 1) If I run a full-screen app like Kodi when I turn the monitor off, when I turn it back on, the full-screen app remains always on top even if I switch to another app with ALT-tab. Kodi no longer appears in the list of apps that I can switch to with ALT-tab. Kodi also only receives mouse input and not keyboard input. (None of these bugs occur when running in unity/compiz, btw.) 2) gnome-shell sets the screen resolution very low when the monitor is turned off, and has to change it back when the monitor returns. I don't know if that is causing any of the issues in (1).
I tested patching the 3.26.2 mutter source rpm package of Fedora 27 with 6dcce19932. However, it doesn't seem to be compiling, giving out > x11/window-x11.c: In function 'meta_window_x11_get_type': > x11/window-x11.c:56:29: error: invalid application of 'sizeof' to incomplete type 'MetaWindowX11Class {aka struct _MetaWindowX11Class}' One other thing with FC-27 in particular is that the default `gdm` graphical login starts in Wayland and also implicitly seems to start gnome-shell, so even if this fix applies to X11, gnome-shell will still crash.
I had a little more time today to compile a new version of the latest mutter rpm that is presently available in Fedora-27 (3.26.2, https://www.rpmfind.net/linux/RPM/fedora/updates/27/x86_64/Packages/m/mutter-devel-3.26.2-2.fc27.x86_64.html) plus the aforementioned patch https://gitlab.gnome.org/GNOME/mutter/commit/6dcce19932 that skips retrieving the monitor geometry on non-existing monitors. I didn't face any compilation issues, as I reported some days ago, so I was likely using the wrong source tree (or wrong patch). I am happy to report that, so far so good, using gnome-shell with X11 (note I also use gdm which uses Wayland); I've attempted to lock the screen and power off the monitor (Dell P2715Q) a number of times and things remain stable, despite my AMD RX560 reporting: ``` [drm:amdgpu_atombios_dp_link_train [amdgpu]] *ERROR* displayport link status failed [drm:amdgpu_atombios_dp_link_train [amdgpu]] *ERROR* clock recovery failed ``` With the stock 3.26.2 FC27 mutter rpm, every time I powered off the monitor I received the above amdgpu errors and gnome-shell crash with this stack trace: https://bugs.freedesktop.org/attachment.cgi?id=137017 re: meta_window_move_resize_request(). Jonas, correctly mentioned in another issue (https://bugzilla.gnome.org/show_bug.cgi?id=789501#c20) that such stack traces indicate the problem described in this issue.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/mutter/-/issues/ Thank you for your understanding and your help.