mzur / gnome-shell-wsmatrix

GNOME shell extension to arrange workspaces in a two-dimensional grid with workspace thumbnails
GNU General Public License v3.0
464 stars 58 forks source link

Unplugging external monitor leads to gnome-shell crash #257

Open bkuczenski opened 1 year ago

bkuczenski commented 1 year ago

Hi, this is a re-opening of #238 with some more information. Environment: Arch linux, current Gnome desktop (44.3). use of this extension in 2x3 arrangement, with an external monitor connected via USB-C to VGA. Intel i915 laptop display.

When I unplug the external monitor, with roughly 1/6 odds, I will get a syslog event including the following:

Aug 09 15:56:57 glyph gnome-shell[39000]: Attempting to call back into JSAPI during the sweeping phase of GC. This is most likely caused by not destroying a Clutter actor or Gtk+ widget with ::destroy signals connected, but can also be caused by using the destroy(), dispose(), or remove() vfuncs. Because it would crash the application, it has been blocked and the JS callback not invoked.
Aug 09 15:56:57 glyph gnome-shell[39000]: == Stack trace for context 0x55c5c3310440 ==
Aug 09 15:56:57 glyph gnome-shell[39000]: The offending signal was window-entered-monitor on MetaDisplay 0x55c5c3682b00.

window-left-monitor also appears as a signal.

The above 3 messages are repeated endlessly until the crash state is resolved. The computer is unusable while the event is ongoing. killing gnome-shell resolves the crash- though sometimes it recovers on its own e.g by tty-switching. This crash generated 10.8MB of log output (57k lines) during 1s of crash state.

It is 100% correlated with use of this extension. How can I help solve this?

mzur commented 1 year ago

It is 100% correlated with use of this extension.

So if you disable the extension the error does not occur?

bkuczenski commented 1 year ago

That's right. I had the extension turned off for many weeks and did not see this recur. Then I tried again after a recent system upgrade and once again the crashes occurred. I cannot say anything conclusive yet about whether it helps for me to "switch off" the extension prior to unplugging the monitor (haven't seen a crash like this yet, but n is small)

mzur commented 1 year ago

Do you have "Show popup for all monitors" enabled? If yes, please disable it and see if the crash occurs again.

bkuczenski commented 1 year ago

I do indeed have "show popup for all monitors" enabled, as well as "show popup" and "show workspace grid in overview". The others are disabled. I will experiment with these settings and report back.

bkuczenski commented 1 year ago

FYI, I did observe another crash (although on wakeup after sleep) with "show popup for all monitors" unchecked.

I then disabled "show popup" and "show workspace grid in overview" and have not observed a crash in n=5 or so. I will keep monitoring and will later re-enable + observe.

current settings: image

bkuczenski commented 1 year ago

Finally caught it! I was running with all options turned off for 30 days and did not observe the bug. Yesterday I switched on "Show popup". Today I observed the crash after the following circumstances:

Fortunately, this time an explicit stack trace was provided in the journal:

Sep 21 11:30:58 glyph gnome-shell[1393]: Attempting to call back into JSAPI during the sweeping phase of GC. This is most likely caused by not destroying a Clutter actor or Gtk+ widget with ::destroy signals connected, but can also be caused by using the destroy(), dispose(), or remove() vfuncs. Because it would crash the application, it has been blocked and the JS callback not invoked.
Sep 21 11:30:58 glyph gnome-shell[1393]: == Stack trace for context 0x5555af762a90 ==
Sep 21 11:30:58 glyph gnome-shell[1393]: #0   5555bbe30880 i   resource:///org/gnome/shell/ui/main.js:629 (d6cdf1babf0 @ 412)
Sep 21 11:30:58 glyph gnome-shell[1393]: #1   5555bbe307a0 i   resource:///org/gnome/shell/ui/switcherPopup.js:105 (2fb078b08fb0 @ 66)
Sep 21 11:30:58 glyph gnome-shell[1393]: #2   5555bbe30700 i   /home/b/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceSwitcherPopup.js:115 (ec8f5355380 @ 270)
Sep 21 11:30:58 glyph gnome-shell[1393]: #3   5555bbe30650 i   /home/b/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js:458 (ec8f5353380 @ 314)
Sep 21 11:30:58 glyph gnome-shell[1393]: #4   7fff5dd3c840 I   self-hosted:164 (57d504cd510 @ 272)
Sep 21 11:30:58 glyph gnome-shell[1393]: #5   5555bbe305c8 i   /home/b/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js:435 (ec8f5353330 @ 139)
Sep 21 11:30:58 glyph gnome-shell[1393]: #6   5555bbe304f8 i   /home/b/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js:416 (ec8f53532e0 @ 1120)
Sep 21 11:30:58 glyph gnome-shell[1393]: #7   7fff5dd3d200 b   self-hosted:1115 (1084d1193b50 @ 501)
Sep 21 11:30:58 glyph gnome-shell[1393]: The offending signal was notify on MetaStage 0x5555af726480.

In this crash event, notify was the offending signal 254 times, and the above stack trace appears in the journal 254 times.

There was a second stack trace that appeared 9 times:

Sep 21 11:30:58 glyph gnome-shell[1393]: == Stack trace for context 0x5555af762a90 ==
Sep 21 11:30:58 glyph gnome-shell[1393]: #0   5555bbe307a0 i   resource:///org/gnome/shell/ui/switcherPopup.js:123 (2fb078b08fb0 @ 396)
Sep 21 11:30:58 glyph gnome-shell[1393]: #1   5555bbe30700 i   /home/b/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceSwitcherPopup.js:115 (ec8f5355380 @ 270)
Sep 21 11:30:58 glyph gnome-shell[1393]: #2   5555bbe30650 i   /home/b/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js:458 (ec8f5353380 @ 314)
Sep 21 11:30:58 glyph gnome-shell[1393]: #3   7fff5dd3c840 I   self-hosted:164 (57d504cd510 @ 272)
Sep 21 11:30:58 glyph gnome-shell[1393]: #4   5555bbe305c8 i   /home/b/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js:435 (ec8f5353330 @ 139)
Sep 21 11:30:58 glyph gnome-shell[1393]: #5   5555bbe304f8 i   /home/b/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js:416 (ec8f53532e0 @ 1120)
Sep 21 11:30:58 glyph gnome-shell[1393]: #6   7fff5dd3d200 b   self-hosted:1115 (1084d1193b50 @ 501)

In this version of the stack, the 0 entry is either switcherPopup.js: 123 (3 instances) or 124 (6 instances).

The vast majority of crashes (presumably the ones from callbacks) generated empty stack traces. SourceFunc() was an offending callback about 30k instances.

I saved the log but it is 20MB so I will hold off on posting it unless you need more information.

mzur commented 1 year ago

Thanks, this looks like enough info to locate the issue!

mzur commented 11 months ago

I have a potential fix for this in #271. It's implemented in the extension version for GNOME Shell 45 but you could patch it in your installed version and check if the errors occur again.