nlpsuge / gnome-shell-extension-another-window-session-manager

A Gnome shell extension to close open windows gracefully and save them as a session. The previous session can be restored at startup. Most importantly, it supports both X11 and Wayland!
https://extensions.gnome.org/extension/4709/another-window-session-manager/
GNU General Public License v3.0
140 stars 8 forks source link

Extension causing segmentation faults #62

Open Derisis13 opened 1 year ago

Derisis13 commented 1 year ago

When extension is enabled Gnome starts crashing frequently. I dug around in journalctl and found a bunch of JS ERROR: out of memory and

JS ERROR: [ERROR  ][Another window session manager] Error adding session items while session was changed: GLib.FileError: Failed to map /home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/schemas/gschemas.compiled' /home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/schemas/gschemas.compiled': mmap() failed: Cannot allocate memory
                                        getSettings@resource:///org/gnome/shell/misc/extensionUtils.js:200:31
                                        PrefsUtils@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/utils/prefsUtils.js:10:40
                                        Log@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/utils/log.js:12:28
                                        _init@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItemButtons.js:34:21
                                        SessionItemButtons@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItemButtons.js:29:1
                                        _init@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItem.js:43:36
                                        PopupBaseMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:73:4
                                        PopupMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:277:1
                                        SessionItem@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItem.js:13:1
                                        _addSessionItems@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/indicator.js:350:20
                                        async*_sessionChanged@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/indicator.js:433:14

as well as

Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await expression. Stack trace of the failed promise:
                                          _promisify/proto[asyncFunc]@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:420:16
                                          RemoteSearchProvider@resource:///org/gnome/shell/ui/remoteSearch.js:211:20
                                          RemoteSearchProvider2@resource:///org/gnome/shell/ui/remoteSearch.js:342:9
                                          loadRemoteSearchProvider@resource:///org/gnome/shell/ui/remoteSearch.js:117:34
                                          collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:28
                                          loadRemoteSearchProviders@resource:///org/gnome/shell/ui/remoteSearch.js:140:15
                                          _reloadRemoteProviders@resource:///org/gnome/shell/ui/search.js:624:22

finally

Nov 05 20:43:35 t490 gnome-shell[8447]: JS ERROR: [ERROR  ][Another window session manager] Error adding session items while session was changed: Error: Must pass an exception and optionally a message to logError()
                                        error@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/utils/log.js:27:17
                                        _addSessionItems/<@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/indicator.js:311:34

and then shortly a gnome segfault takes my entire wayland session.

I'd like to paste in the entire log, but these errors repeat so many times, I can't reduce my terminal size so all of them fit them all.

nlpsuge commented 1 year ago

Thanks for reporting this issue. Investigate it later.

nlpsuge commented 1 year ago

@Derisis13

Please provide me those information:

nlpsuge commented 1 year ago

When extension is enabled Gnome starts crashing frequently. I dug around in journalctl and found a bunch of JS ERROR: out of memory and

JS ERROR: [ERROR  ][Another window session manager] Error adding session items while session was changed: GLib.FileError: Failed to map /home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/schemas/gschemas.compiled' /home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/schemas/gschemas.compiled': mmap() failed: Cannot allocate memory

@Derisis13

Hi, Can you find any other mmap() failed: Cannot allocate memory related to other apps or extensions in the logs? Is it that possible that your memory was actually run out?

Derisis13 commented 1 year ago

Thanks for helping!

My host runs Pop!_OS 22.04 which packages gnome 42.4 with wayland as the compositor. It has 16GB of RAM + 4GB swap which have been exhausted before - by memory leaks, but on these occasions the OOM killer acted before a segmentation fault happened.

I tried searching for more mmap failures in journalctl but only found similar segmentation faults, like this from oct.25:

Oct 25 21:41:44 t490 gnome-shell[8560]: JS ERROR: [ERROR  ][Another window session manager] Error adding session items while session was changed: GLib.FileError: Failed to map /home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/schemas/gschemas.compiled' /home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/schemas/gschemas.compiled': mmap() failed: Cannot allocate memory
                                        getSettings@resource:///org/gnome/shell/misc/extensionUtils.js:200:31
                                        PrefsUtils@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/utils/prefsUtils.js:10:40
                                        Log@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/utils/log.js:12:28
                                        _init@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItemButtons.js:34:21
                                        SessionItemButtons@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItemButtons.js:29:1
                                        _init@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItem.js:43:36
                                        PopupBaseMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:73:4
                                        PopupMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:277:1
                                        SessionItem@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItem.js:13:1
                                        _addSessionItems@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/indicator.js:356:24
                                        async*_sessionChanged@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/indicator.js:433:14
Oct 25 21:41:44 t490 gnome-shell[8560]: JS ERROR: [ERROR  ][Another window session manager] Error adding session items while session was changed: GLib.FileError: Failed to map /home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/schemas/gschemas.compiled' /home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/schemas/gschemas.compiled': mmap() failed: Cannot allocate memory
                                        getSettings@resource:///org/gnome/shell/misc/extensionUtils.js:200:31
                                        PrefsUtils@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/utils/prefsUtils.js:10:40
                                        Log@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/utils/log.js:12:28
                                        _init@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItemButtons.js:34:21
                                        SessionItemButtons@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItemButtons.js:29:1
                                        _init@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItem.js:43:36
                                        PopupBaseMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:73:4
                                        PopupMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:277:1
                                        SessionItem@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItem.js:13:1
                                        _addSessionItems@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/indicator.js:350:20
                                        async*_sessionChanged@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/indicator.js:433:14
Oct 25 21:41:44 t490 gnome-shell[8560]: JS ERROR: [ERROR  ][Another window session manager] Error adding session items while session was changed: GLib.FileError: Failed to map /home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/schemas/gschemas.compiled' /home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/schemas/gschemas.compiled': mmap() failed: Cannot allocate memory
                                        getSettings@resource:///org/gnome/shell/misc/extensionUtils.js:200:31
                                        PrefsUtils@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/utils/prefsUtils.js:10:40
                                        Log@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/utils/log.js:12:28
                                        _init@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItemButtons.js:34:21
                                        SessionItemButtons@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItemButtons.js:29:1
                                        _init@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItem.js:43:36
                                        PopupBaseMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:73:4
                                        PopupMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:277:1
                                        SessionItem@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/ui/sessionItem.js:13:1
                                        _addSessionItems@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/indicator.js:350:20
                                        async*_sessionChanged@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/indicator.js:433:14
Oct 25 21:41:44 t490 gnome-shell[8560]: Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await expression. Stack trace of the failed promise:
Oct 25 21:41:45 t490 gnome-shell[8560]: Hit MOZ_CRASH([unhandlable oom] ExecutableAllocator::reprotectPool) at ./js/src/vm/JSContext.cpp:1213
Oct 25 21:41:45 t490 kernel: gnome-shell[8560]: segfault at 0 ip 00007f05efadc1d6 sp 00007ffde6bcfbe0 error 6 in libmozjs-91.so.91.10.0[7f05efad3000+8e3000]
Oct 25 21:41:45 t490 kernel: Code: 80 a5 0d 00 4c 89 e2 48 89 df 31 c0 48 8d 35 6c c3 8f 00 e8 9c 48 1d 00 48 89 df e8 d2 8f 02 00 48 8b 05 bd b9 ab 00 48 89 18 <c7> 04 25 00 00 00 00 00 00 00 00 0f 0b 90 41 54 49 89 d4 55 48 89

There are more similar segfaults of gnome I could find, so even if this extension isn't the cause of the problem it's at least accelerating it.

nlpsuge commented 1 year ago

finally

Nov 05 20:43:35 t490 gnome-shell[8447]: JS ERROR: [ERROR  ][Another window session manager] Error adding session items while session was changed: Error: Must pass an exception and optionally a message to logError()
                                        error@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/utils/log.js:27:17
                                        _addSessionItems/<@/home/lacko/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/indicator.js:311:34

I had uploaded a new version to fix this issue. Let's see what the error really is, which might be useful to address this issue.

nlpsuge commented 1 year ago

@Derisis13 Hi, do you still have this issue recently?

Derisis13 commented 1 year ago

Having my DE crash all the time was so frustrating I turned off the extension. I'll try it to see if the issue persists