Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logs an error and traceback when some other program requests an unknown property #165

Open
foresto opened this issue Aug 15, 2024 · 3 comments

Comments

@foresto
Copy link

foresto commented Aug 15, 2024

When some other program on the bus tries to access a nonexistent property on a dbus-next service, BaseMessageBus currently raises an exception, and handles it by writing both a log message and a stack trace at the ERROR log level.

For example:

got unexpected error processing a message: interface "org.kde.StatusNotifierItem" does not have property "IconThemePath".
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus_next/message_bus.py", line 621, in _on_message
    self._process_message(msg)
  File "/usr/lib/python3/dist-packages/dbus_next/message_bus.py", line 712, in _process_message
    handler(msg, send_reply)
  File "/usr/lib/python3/dist-packages/dbus_next/message_bus.py", line 898, in _default_properties_handler
    raise DBusError(
dbus_next.errors.DBusError: interface "org.kde.StatusNotifierItem" does not have property "IconThemePath"

That's a lot of noise to have spamming my application's (and users') logs. I could silence it by disabling all dbus-next logs below CRITICAL, but then I would miss any legitimate errors if they come up.

Since an external program requesting an invalid property is not a bug in the program using dbus-next, shouldn't the log message be downgraded to DEBUG or INFO level? And shouldn't the stack trace be removed entirely?

And, if the library is going to log anything, shouldn't it also log which dbus sender tried to access the nonexistent property?

@elParaguayo
Copy link
Contributor

Not a solution to your problem (and you may not get one as the package seems to be unmaintained...), however I've written a StatusNoifierHost app and I check every StatusNotifierItem for the Menu property. It is part of the spec and I've not come across an app that hasn't provided it.

Why not just provide an empty string?

I do appreciate the above was just an example so your issue remains valid.

@foresto
Copy link
Author

foresto commented Aug 17, 2024

Not a solution to your problem (and you may not get one as the package seems to be unmaintained...),

I'm not looking for a solution for my own code. I can work around it in the current situation. However...

Why not just provide an empty string?

I reported this because it's a general problem. It doesn't apply only to the Icon property. (Note that I updated my example to show the same thing happening with an IconThemePath property, which is not in that interface's spec.) More importantly, it doesn't apply only to this particular interface.

It applies any time an external program tries to access something that isn't there, whether it's in (some version of) a spec or not. Users of this library shouldn't be burdened with spurious error logs and stack traces just because some other software, outside of our control, happens to be impolite. :)

@elParaguayo
Copy link
Contributor

Yeah, that's totally fair (and I've come across the issue myself). However, as this package seems to be unmaintained, I doubt you'll see anything change any time soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants