mate-desktop / mate-screensaver

MATE screen saver and locker
https://mate-desktop.org
GNU General Public License v2.0
48 stars 40 forks source link

Mate 1.26 screensaver/logout fails #263

Closed bob-10598 closed 2 years ago

bob-10598 commented 3 years ago

Expected behaviour

Lock screen icon on menu bar starts screensaver

Actual behaviour

screensaver aborts

Steps to reproduce the behaviour

Update 1.24 to 1.26 Click lockscreen icon copy on panel

MATE general version

1.26

Package version

Linux Distribution

Fedora 34

Link to bugreport of your Distribution (requirement)

https://bugzilla.redhat.com/show_bug.cgi?id=1997852

lukefromdc commented 3 years ago

I was unable to duplicate this on Debian Unstable, note that Debian does not use some of the default PAM stuff in /etc because that does not work with Debian for some reason.

kimmalmo commented 2 years ago

I've upgraded Mate from 1.24 to 1.26 using https://launchpad.net/~ubuntu-mate-dev/+archive/ubuntu/fresh-mate on 21.04 and the lock screen does not work for me at all. Neither from hotkeys ( Ctrl+Alt+L / Super+L ), system menu nor with the lock screen icon on panel.

mbkma commented 2 years ago

I can not reproduce these issues on Manjaro and MATE 1.26.

raveit65 commented 2 years ago

@mbkma Same for me, i can't reproduce any of this bugs (mate-screensaver, mate-panel) with several machines running f34. And i tried hard to reproduce this m-s bug with a notebook only running in mate-screensaver mode for the last 4 days. Here i used the unlock-dialog or without. No chance, m-s works like expected. But i am happy to try again when someone post clearly steps-to-reproduce which trigger the issue. Btw. Unlocking a black monitor isn't a useful information........

But maybe we have an issue with old existing dconf-settings. Because we moved a lot ot gsettings or other files to a gresource, which is one of the main changes of 1.26 all over packages. Also, i am wondering about backtrace at rhbz report. https://bugzilla.redhat.com/show_bug.cgi?id=1997852

Truncated backtrace:
Thread no. 1 (10 frames)
 #0 matemenu_tree_item_ref at /usr/src/debug/mate-menus-1.26.0-1.fc34.x86_64/libmenu/matemenu-tree.c:1799
 mate-desktop/mate-screensaver#1 find_info_for_id at /usr/src/debug/mate-screensaver-1.26.0-1.fc34.x86_64/src/gs-theme-manager.c:270
 mate-desktop/mate-screensaver#2 gs_theme_manager_lookup_theme_info at /usr/src/debug/mate-screensaver-1.26.0-1.fc34.x86_64/src/gs-theme-manager.c:308
 mate-desktop/mate-screensaver#3 manager_select_theme_for_job at /usr/src/debug/mate-screensaver-1.26.0-1.fc34.x86_64/src/gs-manager.c:257
 mate-desktop/mate-screensaver#4 manager_show_window at /usr/src/debug/mate-screensaver-1.26.0-1.fc34.x86_64/src/gs-manager.c:1318
 mate-desktop/mate-screensaver#5 window_show_cb at /usr/src/debug/mate-screensaver-1.26.0-1.fc34.x86_64/src/gs-manager.c:1352
 mate-desktop/mate-screensaver#10 gtk_widget_show at /usr/src/debug/gtk3-3.24.30-1.fc34.x86_64/gtk/gtkwidget.c:4848
 mate-desktop/mate-screensaver#11 show_windows at /usr/src/debug/mate-screensaver-1.26.0-1.fc34.x86_64/src/gs-manager.c:1781
 mate-desktop/mate-screensaver#12 gs_manager_activate at /usr/src/debug/mate-screensaver-1.26.0-1.fc34.x86_64/src/gs-manager.c:1857
 mate-desktop/mate-screensaver#13 gs_manager_set_active at /usr/src/debug/mate-screensaver-1.26.0-1.fc34.x86_64/src/gs-manager.c:1903

Because crash function matemenu_tree_item_ref, comes from mate-menus and is only use by mate-panel and not by mate-screensaver.

[rave@mother github-matedesktop]$ grep -nr matemenu_tree_item_ref *
mate-menus/libmenu/matemenu-tree.c:869:  return matemenu_tree_item_ref (tree->root);
mate-menus/libmenu/matemenu-tree.c:948:  return directory ? matemenu_tree_item_ref (directory) : NULL;
mate-menus/libmenu/matemenu-tree.c:970:    matemenu_tree_item_ref (entry);
mate-menus/libmenu/matemenu-tree.c:985:  return item->parent ? matemenu_tree_item_ref (item->parent) : NULL;
mate-menus/libmenu/matemenu-tree.c:1106:  g_slist_foreach (iter->contents, (GFunc) matemenu_tree_item_ref, NULL);
mate-menus/libmenu/matemenu-tree.c:1151:  return (MateMenuTreeDirectory*)matemenu_tree_item_ref (iter->item);
mate-menus/libmenu/matemenu-tree.c:1170:  return (MateMenuTreeEntry*)matemenu_tree_item_ref (iter->item);
mate-menus/libmenu/matemenu-tree.c:1189:  return (MateMenuTreeHeader*)matemenu_tree_item_ref (iter->item);
mate-menus/libmenu/matemenu-tree.c:1208:  return (MateMenuTreeAlias*)matemenu_tree_item_ref (iter->item);
mate-menus/libmenu/matemenu-tree.c:1227:  return (MateMenuTreeSeparator*)matemenu_tree_item_ref (iter->item);
mate-menus/libmenu/matemenu-tree.c:1453:  return matemenu_tree_item_ref (header->directory);
mate-menus/libmenu/matemenu-tree.c:1485:    return matemenu_tree_item_ref(alias->directory);
mate-menus/libmenu/matemenu-tree.c:1532:  return (MateMenuTreeDirectory *) matemenu_tree_item_ref (alias->aliased_item);
mate-menus/libmenu/matemenu-tree.c:1547:  return (MateMenuTreeEntry *) matemenu_tree_item_ref (alias->aliased_item);
mate-menus/libmenu/matemenu-tree.c:1668:  retval->directory = matemenu_tree_item_ref (directory);
mate-menus/libmenu/matemenu-tree.c:1701:  retval->directory    = matemenu_tree_item_ref (directory);
mate-menus/libmenu/matemenu-tree.c:1703:    retval->aliased_item = matemenu_tree_item_ref (item);
mate-menus/libmenu/matemenu-tree.c:1707:      retval->aliased_item = matemenu_tree_item_ref (alias->aliased_item);
mate-menus/libmenu/matemenu-tree.c:1786: * matemenu_tree_item_ref:
mate-menus/libmenu/matemenu-tree.c:1792:matemenu_tree_item_ref (gpointer itemp)
mate-menus/libmenu/matemenu-tree.c:4362:                    matemenu_tree_item_ref (alias));
mate-menus/libmenu/matemenu-tree.c:4399:                        matemenu_tree_item_ref (subdir));
mate-menus/libmenu/matemenu-tree.c:4445:                    matemenu_tree_item_ref (entry));
mate-menus/libmenu/matemenu-tree.c:5011:          (GBoxedCopyFunc)matemenu_tree_item_ref,
mate-menus/libmenu/matemenu-tree.c:5024:          (GBoxedCopyFunc)matemenu_tree_item_ref,
mate-menus/libmenu/matemenu-tree.c:5037:          (GBoxedCopyFunc)matemenu_tree_item_ref,
mate-menus/libmenu/matemenu-tree.c:5050:          (GBoxedCopyFunc)matemenu_tree_item_ref,
mate-menus/libmenu/matemenu-tree.c:5063:          (GBoxedCopyFunc)matemenu_tree_item_ref,
mate-menus/libmenu/matemenu-tree.h:106:gpointer matemenu_tree_item_ref   (gpointer item);
mate-panel/mate-panel/menu.c:931:               matemenu_tree_item_ref (directory),
mate-panel/mate-panel/menu.c:1040:              matemenu_tree_item_ref (header),
mate-panel/mate-panel/menu.c:1058:              matemenu_tree_item_ref (entry),
mate-panel/mate-panel/menu.c:1067:                  matemenu_tree_item_ref (alias_directory)
flexiondotorg commented 2 years ago

I built mate-menus for Ubuntu MATE 21.04 with this commit reverted:

I have confirmations from testers that the segfaults in mate-screensaver are resolved.

rbuj commented 2 years ago

According to the attached backtrace, the issue is that the screensaver manager "xscreensaver" is also installed on the system, apparently xscreensaver conflicts with mate-screensaver since the recent changes in xscreensaver.

rbuj commented 2 years ago

offtopic - Why is xscreensaver displayed in the "Internet and Network" section?

Captura de Pantalla 2021-10-13 a les 9 41 49

Note: mate-screensaver is displayed in Look & Feel section.

raveit65 commented 2 years ago

Since 1.26 is released i have this rhbz report https://bugzilla.redhat.com/show_bug.cgi?id=1997852 I asked user for removing xscreensaver if installed. On my boxes only mate-screensaver is installed, in result i can't reproduce the issue.

raveit65 commented 2 years ago

offtopic - Why is offtopic - Why is xscreensaver displayed in the "Internet and Network" section? displayed in the "Internet and Network" section?

No idea, i don't see any desktop file for xscreensaver?

rbuj commented 2 years ago

There is no problem with using xscreensaver instead of mate-screensaver as your screensaver. mate-screensaver has preference over xscreensaver when both packages are installed on the system. https://github.com/mate-desktop/mate-panel/blob/271bd0c937b4773cf08ec29a60abe33fa125a9e8/mate-panel/panel-util.c#L384-L391 For this reason you'll need to remove mate-screensaver. Next, you'll need run the xscreensaver daemon on session startup, to do so on Fedora, you have to comment the line "#OnlyShowIn=X-NODEFAULT;" in the file /etc/xdg/autostart/xscreensaver-autostart.desktop, which actually prevents it from running at startup on all desktop managers, including MATE.

ProMarbler14 commented 2 years ago

I have the same crash when I try locking the screen with the Ctrl-Alt-L hotkey; from a gdb analysis of my coredump it appears to be selecting a theme for "screensavers-popsquares" and uses id "screensavers-popsquares.desktop" to find the info. The desktop file appears be be installed at "/usr/share/applications/screensavers/popsquares.desktop", and the "menu tree" appears to be "/etc/xdg/menus/mate-screensavers.menu". The menu tree does not appear to be loaded (loaded = 0); "root" is also null. The crash happens because it dereferences a null pointer (root) to increase the refcount.

I can attach a full traceback or GDB session if you think that it will be helpful. My system is up-to-date Archlinux with MATE 1.26, with the exception that mate-panel is still 1.26.0 (not .1).

The stack trace is slightly misleading as matemenu_tree_item_ref is called by matemenu_tree_get_root_directory but the latter appears to have been inlined.

raveit65 commented 2 years ago

There is no problem with using xscreensaver instead of mate-screensaver as your screensaver. mate-screensaver has preference over xscreensaver when both packages are installed on the system.

https://github.com/mate-desktop/mate-panel/blob/271bd0c937b4773cf08ec29a60abe33fa125a9e8/mate-panel/panel-util.c#L384-L391

For this reason you'll need to remove mate-screensaver. Next, you'll need run the xscreensaver daemon on session startup, to do so on Fedora, you have to comment the line "#OnlyShowIn=X-NODEFAULT;" in the file /etc/xdg/autostart/xscreensaver-autostart.desktop, which actually prevents it from running at startup on all desktop managers, including MATE.

You did complete misunderstood me. Why should i run xscreensaver? No need to explain how to use xscreensaver ;)

rbuj commented 2 years ago

I have been unable to reproduce the issue on Fedora. However, on ubuntu there is a segment violation on mate-screensaver after changing the menu layout using mate-tweak. Steps to reproduce:

zhuyaliang commented 2 years ago

Archlinux lock screen works normally. This problem is unique only on Ubuntu

rbuj commented 2 years ago

I built mate-menus for Ubuntu MATE 21.04 with this commit reverted:

I have confirmations from testers that the segfaults in mate-screensaver are resolved.

https://github.com/mate-desktop/mate-menus/pull/102 allows disabling the Collection menu which seems to be responsible for the segfault on Ubuntu MATE 21.10:

raveit65 commented 2 years ago

I built mate-menus for Ubuntu MATE 21.04 with this commit reverted:

* [mate-desktop/mate-menus@1c989ea](https://github.com/mate-desktop/mate-menus/commit/1c989ea4e5ea375167a7646aaf4e6dbc1cf19446)

I have confirmations from testers that the segfaults in mate-screensaver are resolved.

I did a scratch build for fedora 34 with that commit removed, but user said it doesn't solved his issue, see https://bugzilla.redhat.com/show_bug.cgi?id=2016789 @flexiondotorg What reports did you fix with reverting that commit?

So, it seems we got several issues and culprit commits which causes issues in fedora and ubuntu. Well, i can't reproduce both mentioned issues at redhat bugzilla for myself, but reports from more than > 6 users shows that mate-screensaver-1.26 is really unstable with fedora. Sadly, i can't bisect git history for myself without clear reproducible "steps-to-reproduce".

ProMarbler14 commented 2 years ago

If the desktop file database is updated while mate-screensaver is running, then the next screensaver activation will crash mate-screensaver. So whenever a .desktop file in /usr/share/applications is updated by e.g. a package manager, a crash is inevitable.

To reproduce:

  1. (start mate-screensaver)
  2. (as root) cp /usr/share/applications/mate-panel.desktop /usr/share/applications/TMPTMPTMP.desktop; rm /usr/share/applications/TMPTMPTMP.desktop
  3. mate-screensaver-command -a

I noticed that whenever the applications directory is updated, in mate-panel matemenu_tree_load_sync immediately gets called, followed by matemenu_tree_get_root_directory (based on some verbosity I added to libmate-menu). In mate-screensaver, these functions are never called, and matemenu_tree_get_root_directory is called without ever loading the tree.

lukefromdc commented 2 years ago

Just confirmed this on my Debian Unstable based system: running the suggested commands crashed the screensaver with a segfault

ProMarbler14 commented 2 years ago

It seems that the not-loaded bug has been there since the switch to the "new mate-menus api" in mate-screensaver, but the segfault appears to be dependent on how mate-menus is compiled. If mate-menus was compiled with --enable-debug it seems to avoid the crash. Commit https://github.com/mate-desktop/mate-menus/commit/e1883c2a66d43c6a7cd839af87a6bcf995d257e2 in mate-menus appears to introduce the crash, but I believe it to be a symptom, not the problem.

When it doesn't crash, the screensaver activates but only shows a black screen, which is a familiar occurrence to me.

rbuj commented 2 years ago

I can't reproduce your core dumped, note I disabled the collection menu entry when I built and installed the mate-menus from sources. https://github.com/mate-desktop/mate-menus/commit/0af959c26303eda2f7e16f938b4d9c6d2df2007e

If you confirm that it's the culprit of the core dumped, I think the collection menu entry of mate-menus should be disabled by default.

rbuj commented 2 years ago

@ProMarbler14 I think it occurs due to the monitors in mate-menus, since a static menu doesn't produce your issues. get_themes_tree () is only called once in the initialization of GSThemeManager, so it seems it loses the references when the monitor detects changes in the directory DefaultAppDirs

$ cat /etc/xdg/menus/mate-screensavers.menu
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
 "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">

<Menu>

  <Name>Screensavers</Name>
  <Directory>mate-screensaver.directory</Directory>

  <AppDir>/usr/share/applications/screensavers</AppDir>

  <!-- Read standard .directory file location -->
  <DefaultDirectoryDirs/>

  <!-- Read in overrides and child menus from applications-merged/ -->
  <DefaultMergeDirs/>

  <Include>
    <Filename>cosmos-slideshow.desktop</Filename>
    <Filename>footlogo-floaters.desktop</Filename>
    <Filename>gnomelogo-floaters.desktop</Filename>
    <Filename>personal-slideshow.desktop</Filename>
    <Filename>popsquares.desktop</Filename>
  </Include>

</Menu>
ProMarbler14 commented 2 years ago

With https://github.com/mate-desktop/mate-screensaver/pull/262 , the issue appears to be fixed; the screensaver runs normally without any black screen or crash.

raveit65 commented 2 years ago

To reproduce:

1. (start mate-screensaver)

2. (as root) `cp /usr/share/applications/mate-panel.desktop /usr/share/applications/TMPTMPTMP.desktop; rm /usr/share/applications/TMPTMPTMP.desktop`

3. `mate-screensaver-command -a`

With that steps to reproduce i can confirm the issue now, and it doesn't matter whether mate-menus is build with mate-menus_0001-Revert-matemenu-tree-do-not-call-g_settings_get_stri.patch mate-menus_0001-Let-user-disable-collection-menu-entry-disable-colle.patch --disable-collection or from 1.26.0 release. Luckily https://github.com/mate-desktop/mate-screensaver/pull/262 seems to fix the issue.

lukefromdc commented 2 years ago

https://github.com/mate-desktop/mate-screensaver/pull/262 seems to fix this for me too