gtg icon indicating copy to clipboard operation
gtg copied to clipboard

Activating the Hamster plugin without Hamster present will cause tracebacks, and will prevent GTG's future launches with `DBus.Error.NameHasNoOwner` and `DBus.Error.ServiceUnknown`

Open jorgeecardona opened this issue 3 years ago • 7 comments

Hi, I have installed GTG 0.5 via flapak, I am getting the following error the first time I run the app:

~$ flatpak run org.gnome.GTG
GNOME keyring not found, passwords will be not stored after restarting GTG
Gtk-Message: 10:25:52.022: Failed to load module "canberra-gtk-module"
Traceback (most recent call last):
  File "/app/lib/python3.8/site-packages/dbus/bus.py", line 175, in activate_name_owner
    return self.get_name_owner(bus_name)
  File "/app/lib/python3.8/site-packages/dbus/bus.py", line 359, in get_name_owner
    return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
  File "/app/lib/python3.8/site-packages/dbus/connection.py", line 650, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: org.freedesktop.DBus.Error.NameHasNoOwner

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/lib/python3.8/site-packages/GTG/gtk/application.py", line 123, in do_activate
    self.init_shared()
  File "/app/lib/python3.8/site-packages/GTG/gtk/application.py", line 162, in init_shared
    self.init_plugin_engine()
  File "/app/lib/python3.8/site-packages/GTG/gtk/application.py", line 188, in init_plugin_engine
    self.plugin_engine.activate_plugins()
  File "/app/lib/python3.8/site-packages/GTG/core/plugins/engine.py", line 201, in activate_plugins
    plugin.instance.activate(api)
  File "/app/lib/python3.8/site-packages/GTG/plugins/hamster/hamster.py", line 155, in activate
    self.hamster = dbus.SessionBus().get_object('org.gnome.Hamster',
  File "/app/lib/python3.8/site-packages/dbus/bus.py", line 239, in get_object
    return self.ProxyObjectClass(self, bus_name, object_path,
  File "/app/lib/python3.8/site-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/app/lib/python3.8/site-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/app/lib/python3.8/site-packages/dbus/bus.py", line 275, in start_service_by_name
    return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
  File "/app/lib/python3.8/site-packages/dbus/connection.py", line 650, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: org.freedesktop.DBus.Error.ServiceUnknown

This happen the first time I run the app, if I use a different console to run the app it opens without the error. The same happen if I click in the app's icon, the first time gnome just wait for the app to open but no window shows up, if I click again in the icon then the window shows up properly.

I have a GNOME Shell 3.38.4 on a Debian sid. Let me know if you need more info.

jorgeecardona avatar Jun 07 '21 08:06 jorgeecardona

Huh, this is odd... I have no idea what this might mean, and I haven't encountered that (apparently others didn't either). Is that still happening consistently for you, or did you just happen to have a broken d-bus on that particular day that got fixed by a reboot?

nekohayo avatar Jul 11 '21 20:07 nekohayo

It happens consistently; my current gnome installation runs flawlessly, this is the only thing failing at the moment. I can give you versions of installed packages or content of files on request.

jorgeecardona avatar Jul 12 '21 13:07 jorgeecardona

It seems to be caused by the Hamster plugin. Since it says "ServiceUnknown" I guess you don't have Hamster installed. That it shouldn't block the execution is a bug in my opinion. Try disabling the plugin/extension.

Neui avatar Jul 12 '21 19:07 Neui

Aaah, I can indeed reproduce this now, so retitling this ticket for clarity. The trick is to try to activate the plugin without Hamster present on your system. When you do that, you'll get a traceback (that gets caught by the new ErrorPopup module and traceback handler GUI), which appears non-fatal at first, but the next time you try to launch GTG it will turn into a fatal traceback that prevents launch, with output exactly as @jorgeecardona reported above. So perhaps this is a bug @flavin could help with!

The workaround, if any user is encountering this problem for the time being, is to edit the gtg.conf file in the config directory, and remove "hamster" from the activated plugins list.

nekohayo avatar Feb 19 '22 05:02 nekohayo

As an additional note: GTG should also probably have a defensive plugin mechanism that doesn't save the activation state of plugins if an error occurs while trying to activate them, but I don't know how hard that would be to accomplish (or maybe it's just a matter of putting the whole plugin activation call into a giant try-except catch to avoid writing that config when any exception occurs)...

nekohayo avatar Feb 19 '22 05:02 nekohayo

Not sure if this is a related issue to the one above or I should open a new issue, but I recently downloaded the program from Flathub (6/5/22) as well as plugin dependencies and i'm getting a similar issue when trying to enable Hamster time tracking integration after going to options -> plugins. I also tried to see if maybe the Hamster plugin was enabled in the .conf file but it isn't. Any help would be appreciated! Thank you. Here is the error:

Context: Global generic exception

Traceback (most recent call last):
  File "/app/lib/python3.9/site-packages/dbus/bus.py", line 177, in activate_name_owner
    return self.get_name_owner(bus_name)
  File "/app/lib/python3.9/site-packages/dbus/bus.py", line 361, in get_name_owner
    return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
  File "/app/lib/python3.9/site-packages/dbus/connection.py", line 652, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: org.freedesktop.DBus.Error.NameHasNoOwner

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/lib/python3.9/site-packages/GTG/gtk/plugins.py", line 216, in on_plugin_toggle
    self.pengine.activate_plugins([plugin])
  File "/app/lib/python3.9/site-packages/GTG/core/plugins/engine.py", line 202, in activate_plugins
    plugin.instance.activate(api)
  File "/app/lib/python3.9/site-packages/GTG/plugins/hamster/hamster.py", line 155, in activate
    self.hamster = dbus.SessionBus().get_object('org.gnome.Hamster',
  File "/app/lib/python3.9/site-packages/dbus/bus.py", line 241, in get_object
    return self.ProxyObjectClass(self, bus_name, object_path,
  File "/app/lib/python3.9/site-packages/dbus/proxies.py", line 250, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/app/lib/python3.9/site-packages/dbus/bus.py", line 182, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/app/lib/python3.9/site-packages/dbus/bus.py", line 277, in start_service_by_name
    return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
  File "/app/lib/python3.9/site-packages/dbus/connection.py", line 652, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: org.freedesktop.DBus.Error.ServiceUnknown

Software versions:

  • Getting Things GNOME! v0.6
  • CPython 3.9.9 (main, Nov 10 2011, 15:00:00) [GCC 11.2.0]
  • GTK 3.24.34, GLib 2.70.5
  • PyGLib 3.42.1, PyGObject 3.42.1
  • Linux-5.15.0-35-generic-x86_64-with-glibc2.33`

idle5 avatar Jun 05 '22 21:06 idle5

Issue raised by @idle5 solved by managing access rights in flatseal https://github.com/getting-things-gnome/gtg/issues/770#issuecomment-1092811829

But, the error message should be more comprehensive and the soft should not crash.

If it crashes when one wants to register time within GTG, it's because the Hamster server is not running, launch Hamster at least once.

AymericDeschard avatar Jun 29 '22 16:06 AymericDeschard

Oh, it turns out that a gazillion mysterious report tickets (#962, #963, #983, #990 …) were all duplicates of this issue here!

@flavin would you be willing to try to come up with a fix for this, based on the latest git master version in light of the recently merged megaport?


Note: this crash is not the same as #961 / #980.

nekohayo avatar Feb 26 '24 16:02 nekohayo