ubuntu / gnome-shell-extension-appindicator

Adds KStatusNotifierItem support to the Shell
https://extensions.gnome.org/extension/615/appindicator-support/
GNU General Public License v2.0
1.19k stars 160 forks source link

recursive error, feezes system dbusMenu.js:479 #201

Open jvanoosterom opened 4 years ago

jvanoosterom commented 4 years ago

I have an clipboard helper (https://hluk.github.io/CopyQ/) that remembers an unlimited number of items, this possibly causes this

JS ERROR: Exception in callback for signal: child-added: InternalError: too much recursion _init@resource:///org/gnome/shell/ui/popupMenu.js:946:9 wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22 _Base.prototype._construct@resource:///org/gnome/gjs/modules/_legacy.js:18:5 Class.prototype._construct/newClass@resource:///org/gnome/gjs/modules/_legacy.js:114:32 _init@resource:///org/gnome/shell/ui/popupMenu.js:1128:21 wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22 _Base.prototype._construct@resource:///org/gnome/gjs/modules/_legacy.js:18:5 Class.prototype._construct/newClass@resource:///org/gnome/gjs/modules/_legacy.js:114:32 MenuItemFactory.createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:453:29 MenuItemFactory.createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:479:44 MenuItemFactory.createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:479:44 MenuItemFactory.createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:479:44 MenuItemFactory.createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:479:44 MenuItemFactory.createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:479:44

etc

bryceharrington commented 4 years ago

I seem to have hit the same bug (or a very similar one), with this in the journal:

JS ERROR: Exception in callback for signal: child-added: InternalError: too much recursion

JS ERROR: (null) JS ERROR: (null) JS ERROR: (null) _init@resource:///org/gnome/shell/ui/popupMenu.js:107:13 _init@resource:///org/gnome/shell/ui/popupMenu.js:1125:9 createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:470:29 createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:496:44 createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:496:44 createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:496:44 createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:496:44 createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:496:44

I do have this ubuntu indicator extension installed, but no clipboard helper.

Not sure what triggered it, at the time I had been typing into terminal windows not interacting with the gui in any way. This was the only time I noticed this bug since installation a few weeks ago.

JasonLG1979 commented 4 years ago

The child-added signal handler itself causes the child-added signal to be emitted which causes an infinitely recursive loop. Handlers that may cause their own signal to be emitted should use GObject.signal_handler_block and GObject.signal_handler_unblock to prevent recursion.

strawhatgami commented 4 years ago

A more comprehensive feedback, hope it can help:

When this error happens on my machine, gnome-shell starts to take more and more CPU until 100% (of 1 core). From several minutes to several tenth of minutes, gnome-shell become unresponsive: can't swap windows with my permanent left sidebar unresponsive, nor use CTRL+Tab nor SUPER. Even the top clock freezes.

The temporary solution I have is to go in another tty (e.g. CTRL+ALT+F3), get the culprit pid with htop and send it SIGKILL. However as I have to regularly repeat this manual solution (nearly every 2 days) and sometimes gnome-shell does not respawn rightly, it becomes very annoying.

I can do some tests or run some commands if this helps to solve this issue.

installed extensions:

Icons in my upper right corner:

A recent log:

mars 06 08:12:05 mymachine gnome-shell[3815]: JS ERROR: Exception in callback for signal: child-added: InternalError: too much recursion
                                             MenuItemFactory.createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:453:29
                                             MenuItemFactory.createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:479:44
                                             [last line repeated 119 times]
mars 06 08:21:43 mymachine dbus-daemon[3653]: [session uid=1000 pid=3653] Activating service name='org.gnome.ChromeGnomeShell' requested by ':1.1936' (uid=1000 pid=5788 comm="/usr/bin/python3 /usr/bin/chrome-gnome-shell
mars 06 08:21:44 mymachine dbus-daemon[3653]: [session uid=1000 pid=3653] Successfully activated service 'org.gnome.ChromeGnomeShell'
mars 06 08:22:34 mymachine chromium-browser.desktop[15657]: [5788] Uncaught exception of type <class 'GLib.GError'> occured
mars 06 08:22:34 mymachine chromium-browser.desktop[15657]:   File "/usr/bin/chrome-gnome-shell", line 226, in on_input
mars 06 08:22:34 mymachine chromium-browser.desktop[15657]:     self.process_request(request)
mars 06 08:22:34 mymachine chromium-browser.desktop[15657]:   File "/usr/bin/chrome-gnome-shell", line 486, in process_request
mars 06 08:22:34 mymachine chromium-browser.desktop[15657]:     self.check_update(update_url, enabled_only)
mars 06 08:22:34 mymachine chromium-browser.desktop[15657]:   File "/usr/bin/chrome-gnome-shell", line 511, in check_update
mars 06 08:22:34 mymachine chromium-browser.desktop[15657]:     None
mars 06 08:22:34 mymachine chromium-browser.desktop[15657]: [5788] Exception: g-io-error-quark: Timeout was reached (24)

mars 06 08:49:41 mymachine nextcloud[4069]: g_menu_remove_all: assertion 'G_IS_MENU (menu)' failed
mars 06 08:49:41 mymachine nextcloud[4069]: g_menu_insert_item: assertion 'G_IS_MENU (menu)' failed
[last line repeated ~1000 times while second last line repeated ~3 times]

Gnome-shell freezed at this point, upper clock frozen at 8:55

Another freeze captured in logs earlyier (note that they are in reverse order, ie most recent first):

[me killing manually (with -9) /usr/bin/gnome-shell from another tty, thus starting its automatic replacement]
févr. 27 11:25:07 mymachine gnome-session-binary[3735]: WARNING: Application 'org.gnome.Shell.desktop' killed by signal 9
[~163 lines of /usr/lib/gdm3/gdm-x-session stuff between the exception and this line]
févr. 27 11:25:07 mymachine gnome-session[3735]: gnome-session-binary[3735]: WARNING: Application 'org.gnome.Shell.desktop' killed by signal 9
févr. 27 11:25:07 mymachine gsd-power[3982]: Error setting property 'PowerSaveMode' on interface org.gnome.Mutter.DisplayConfig: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnect
févr. 27 11:25:07 mymachine polkitd(authority=local)[1656]: Unregistered Authentication Agent for unix-session:2 (system bus name :1.1864, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, local
févr. 27 11:24:50 mymachine kernel: rfkill: input handler enabledKeyboardMouse
févr. 27 11:24:46 mymachine kernel: rfkill: input handler disabled4000  2160 2163 2168 2222 -hsync -vsync (133.3 kHz eP)
févr. 27 11:24:46 mymachine gsd-power[3982]: Error setting property 'PowerSaveMode' on interface org.gnome.Mutter.DisplayConfig: Le délai d’attente est dépassé (g-io-error-quark, 24)
févr. 27 11:24:23 mymachine kernel: rfkill: input handler enabled
févr. 27 11:24:21 mymachine kernel: rfkill: input handler disabledKeyboardMouse4000  2160 2163 2168 2222 -hsync -vsync (133.3 kHz eP)
févr. 27 11:23:44 mymachine gsd-power[3982]: Error setting property 'PowerSaveMode' on interface org.gnome.Mutter.DisplayConfig: Le délai d’attente est dépassé (g-io-error-quark, 24)
févr. 27 11:23:40 mymachine kernel: rfkill: input handler enabled
févr. 27 11:23:27 mymachine gnome-shell[5148]: JS ERROR: Exception in callback for signal: child-added: InternalError: too much recursion
                                               _init@resource:///org/gnome/shell/ui/popupMenu.js:946:9
                                               wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22
                                               _Base.prototype._construct@resource:///org/gnome/gjs/modules/_legacy.js:18:5
                                               Class.prototype._construct/newClass@resource:///org/gnome/gjs/modules/_legacy.js:114:32
                                               _init@resource:///org/gnome/shell/ui/popupMenu.js:1128:21
                                               wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22
                                               _Base.prototype._construct@resource:///org/gnome/gjs/modules/_legacy.js:18:5
                                               Class.prototype._construct/newClass@resource:///org/gnome/gjs/modules/_legacy.js:114:32
                                               MenuItemFactory.createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:453:29
                                               MenuItemFactory.createItem@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:479:44
                                              [last line repeated 118 times]
JasonLG1979 commented 4 years ago
let foo = new RandomThing();

let id = foo.connect('whatever-signal', () => {
    GObject.signal_handler_block(foo, id);
    // Do stuff that would otherwise cause recursive errors...
    GObject.signal_handler_unblock(foo, id);
});
acesabe commented 4 years ago

Just had my desktop PC (Ubuntu 18:04 5.3.0-28-generic) freeze then power cycle itself which is highly unusual, quick check of journlctrl log brought up similar errors as outlined above

gnome-shell[2102]: JS ERROR: Exception in callback for signal: property-changed: GdkPixbuf.PixbufError: Unrecognised image file format
                                                 MenuItemFactory._updateImage@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:601:32
                                                 MenuItemFactory._onPropertyChanged@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:537:13
                                                 _emit@resource:///org/gnome/gjs/modules/signals.js:128:27
                                                 DbusMenuItem<.property_set@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:128:9
                                                 wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22
                                                 DBusClient<._endRequestProperties/<@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:266:17
                                                 DBusClient<._endRequestProperties@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/dbusMenu.js:261:9
                                                 wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22
                                                 _proxyInvoker/asyncCallback@resource:///org/gnome/gjs/modules/overrides/Gio.js:78:13

Not investigated this further but if others have similar can happily do so (provide more info etc)

JasonLG1979 commented 4 years ago

`GdkPixbuf.PixbufError: Unrecognised image file format

That's not a recursive error. That's an unhanded error while trying to set an icon from a Pixbuf.

Most likely here: https://github.com/ubuntu/gnome-shell-extension-appindicator/blob/master/dbusMenu.js#L618

acesabe commented 4 years ago

Thanks for the clarification, I'm none the wiser however as to what that means or whether it is related or relevant to the original issue here, hope to find what did cause ?Gnome? to crash and power cycle my pc...

Mar 9, 2020 2:10:15 PM Jason Gray notifications@github.com:

`GdkPixbuf.PixbufError: Unrecognised image file format

That's not a recursive error. That's an unhanded error while trying to set an icon from a Pixbuf.

Most likely here: https://github.com/ubuntu/gnome-shell-extension-appindicator/blob/master/dbusMenu.js#L618 [https://github.com/ubuntu/gnome-shell-extension-appindicator/blob/master/dbusMenu.js#L618]

— You are receiving this because you commented. Reply to this email directly, view it on GitHub [https://github.com/ubuntu/gnome-shell-extension-appindicator/issues/201?email_source=notifications&email_token=AAKNEBXDJ7EPMNDIKC7EO2DRGT2CJA5CNFSM4JY5KGJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOHBJWY#issuecomment-596514011] , or unsubscribe [https://github.com/notifications/unsubscribe-auth/AAKNEBVX2H7XUCEK7SK5TNDRGT2CJANCNFSM4JY5KGJQ] . [https://github.com/notifications/beacon/AAKNEBR6MFK6ZMUTGYFUXKDRGT2CJA5CNFSM4JY5KGJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOHBJWY.gif]

JasonLG1979 commented 4 years ago

Thanks for the clarification, I'm none the wiser however as to what that means or whether it is related or relevant to the original issue here, hope to find what did cause ?Gnome? to crash and power cycle my pc...

It's not related. Yours is a different issue.

Basically when ingesting quite possibly malformed data from the outside world they should be wrapping things in a try/catch to avoid crashes like this. Ideally it would fail gracefully, generate a log message and just ignore the misbehaving app instead of taking down your whole desktop.

drien commented 2 years ago

I have been experiencing this periodically on fully patched Ubuntu 21.10. I've been struggling to identify which application specifically is causing it because it only happens every so often and there is nothing useful in the logs beyond what has already been posted in issues here, so I'm down to disabling apps one at a time and waiting a few days for each to see if the problem continues.

That said, it strikes me that any given application that has some incorrect implementation of a tray icon should not be able to hang my entire desktop environment, it'd be much better to somehow limit/catch the recursion depth and let that particular app crash or otherwise fail. I've never worked on gnome extensions but I'm happy to try to contribute if there's interest in addressing this.

acesabe commented 2 years ago

The issue I reported may well have been related to a subsequent hardware issue that may have been brewing for some time before full failure (power supply plug-socket issue) so I cannot disregard that as having been the cause of the issue. This issue has not repeated for me so in my case, issue closed.

drien commented 2 years ago

For what it's worth this became more frequent after my January comment, sometimes happening 3-4 times a day, but I was never able to isolate what specifically was causing it. It hasn't happened at all since upgrading to 22.04 a few weeks ago. :shrug:

jbulow commented 1 year ago

Seeing this issue on ubuntu 22.04.2. Given the lack of activity on this issue I assume a total reinstall of ubuntu is needed?