elvetemedve / gnome-shell-extension-system-monitor

Gnome Shell extension for displaying resource usage
GNU General Public License v3.0
87 stars 15 forks source link

Javascript stack trace with latest gjs from meter.js:35 #46

Open genodeftest opened 6 years ago

genodeftest commented 6 years ago

Steps to reproduce: unclear.

What happens: When running gnome-shell, the org.gnome.Shell.desktop ID logs these stack traces to syslog quite often:

Object Meta.BackgroundActor (0x5575699637a0), has been already finalized. Impossible to get any property from it.
== Stack trace for context 0x55d4af8c2000 ==
#0 0x7ffc203c1910 I   resource:///org/gnome/gjs/modules/_legacy.js:81 (0x7f5ab80c2bc0 @ 45)
#1 0x55d4afb3ee18 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/meter.js:35 (0x7f5a85d30918 @ 99)
#2 0x55d4afb3ed90 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/meter.js:69 (0x7f5a85d30b38 @ 25)
#3 0x7ffc203c32e0 b   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/helpers/promise.js:48 (0x7f5a85d43a28 @ 215)

and some longer versions:

Object Meta.BackgroundActor (0x5575699637a0), has been already finalized. Impossible to get any property from it.
== Stack trace for context 0x55d4af8c2000 ==
#0 0x7ffc203c0990 I   resource:///org/gnome/gjs/modules/_legacy.js:80 (0x7f5ab80c2bc0 @ 26)
#1 0x55d4afb3eeb0 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/widget.js:350 (0x7f5a85d535e8 @ 41)
#2 0x7ffc203c1910 I   resource:///org/gnome/gjs/modules/_legacy.js:82 (0x7f5ab80c2bc0 @ 71)
#3 0x55d4afb3ee18 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/meter.js:35 (0x7f5a85d30918 @ 99)
#4 0x55d4afb3ed90 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/meter.js:69 (0x7f5a85d30b38 @ 25)
#5 0x7ffc203c32e0 b   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/helpers/promise.js:48 (0x7f5a85d43a28 @ 215)
Object Meta.BackgroundActor (0x5575699637a0), has been already finalized. Impossible to get any property from it.
== Stack trace for context 0x55d4af8c2000 ==
#0 0x55d4afb3ef50 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/widget.js:309 (0x7f5a85d53450 @ 10)
#1 0x7ffc203c0990 I   resource:///org/gnome/gjs/modules/_legacy.js:82 (0x7f5ab80c2bc0 @ 71)
#2 0x55d4afb3eeb0 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/widget.js:328 (0x7f5a85d53560 @ 35)
#3 0x7ffc203c1910 I   resource:///org/gnome/gjs/modules/_legacy.js:82 (0x7f5ab80c2bc0 @ 71)
#4 0x55d4afb3ee18 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/meter.js:35 (0x7f5a85d30918 @ 99)
#5 0x55d4afb3ed90 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/meter.js:69 (0x7f5a85d30b38 @ 25)
#6 0x7ffc203c32e0 b   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/helpers/promise.js:48 (0x7f5a85d43a28 @ 215)
Object Meta.BackgroundActor (0x5575699637a0), has been already finalized. Impossible to get any property from it.
== Stack trace for context 0x55d4af8c2000 ==
#0 0x55d4afb3efe8 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/widget.js:102 (0x7f5a85d51670 @ 18)
#1 0x7ffc203bfd90 I   resource:///org/gnome/gjs/modules/_legacy.js:82 (0x7f5ab80c2bc0 @ 71)
#2 0x55d4afb3ef50 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/widget.js:309 (0x7f5a85d53450 @ 51)
#3 0x7ffc203c0990 I   resource:///org/gnome/gjs/modules/_legacy.js:82 (0x7f5ab80c2bc0 @ 71)
#4 0x55d4afb3eeb0 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/widget.js:328 (0x7f5a85d53560 @ 35)
#5 0x7ffc203c1910 I   resource:///org/gnome/gjs/modules/_legacy.js:82 (0x7f5ab80c2bc0 @ 71)
#6 0x55d4afb3ee18 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/meter.js:35 (0x7f5a85d30918 @ 99)
#7 0x55d4afb3ed90 i   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/meter.js:69 (0x7f5a85d30b38 @ 25)
#8 0x7ffc203c32e0 b   /home/username/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/helpers/promise.js:48

These stack traces come in mixed bursts, usually about 50 at once (same second according to syslog).

What should happen: No stacktrace.

Additional info: Printing these stacktraces is a feature introduced in or after 3.26.0 release, afaik. See also: sustmi/gnome-shell-extension-windowoverlay-icons#4 and https://gitlab.gnome.org/GNOME/gnome-shell/issues/11.

It is unclear to me why those stacktraces are thrown. They might be indicating that the object has already been destroyed somewhere else or that it cannot be destroyed because it is still being referenced by from somewhere else.

Please note that I did not disable this extension at all and I don't know why this function gets called. I guess that it is being called on screen lock or suspend.

Installed software versions: gnome-shell-3.26.2-4.fc27.x86_64 gjs-1.50.4-1.fc27.x86_64 mutter-3.26.2-2.fc27.x86_64

elvetemedve commented 6 years ago

Hi @genodeftest,

Thanks for reporting this bug. Updating the GUI happens asynchronously. When you lock your screen the extension will be disabled by Gnome and re-enabled after unocking the screen. The problem is the the UI widgets got destroyed, but the code wants to update it and it fails. As far as I can tell the asynchron operations need to be cancelled when the extension is disabled.

garymoon commented 6 years ago

I have been experiencing this during the beta, and can confirm that it's still happening after the release of Ubuntu Bionic. I'm happy to help out with any fixes.

elvetemedve commented 5 years ago

I'm afraid this still going to happen randomly. There is a technical difficulty as Javascript does not allow cancelling Promise chains (https://stackoverflow.com/questions/29478751/cancel-a-vanilla-ecmascript-6-promise-chain#29479435).