manatools / dnfdragora

dnfdragora is a dnf frontend based on libyui abstraction
GNU General Public License v3.0
137 stars 41 forks source link

Problem with system notifications in Gnome 3 #170

Closed szpak closed 4 years ago

szpak commented 4 years ago

As reported in RedHat Bugzilla I encounter the following problem on Fedora with Gnome Shell 3.36.6:

$ dnfdragora-updater
Try reading configuration file
From ./dnfdragora.yaml
Skipped exception: <[Errno 2] No such file or directory: './dnfdragora.yaml'> 
From /etc/dnfdragora/dnfdragora.yaml
Finally read user settings from /home/foobar/.config/dnfdragora.yaml
Logging disabled

(dnfdragora-updater:26035): Gdk-CRITICAL **: 12:30:30.064: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.8/site-packages/dnfdragora/updater.py", line 343, in __update_loop
    self.__tray.notify(title='dnfdragora-update', message=_('%d updates available.') % self.__update_count)
  File "/usr/lib/python3.8/site-packages/pystray/_base.py", line 234, in notify
    self._notify(message, title)
  File "/usr/lib/python3.8/site-packages/pystray/_util/gtk.py", line 81, in _notify
    self._notifier.notify(title or self.title, message, self._icon_path)
  File "/usr/lib/python3.8/site-packages/pystray/_util/notify_dbus.py", line 69, in notify
    shutil.copy(icon, self._icon),
  File "/usr/lib64/python3.8/shutil.py", line 415, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib64/python3.8/shutil.py", line 261, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpd9ew4mco'
Try reading configuration file
From ./dnfdragora.yaml
Skipped exception: <[Errno 2] No such file or directory: './dnfdragora.yaml'> 
From /etc/dnfdragora/dnfdragora.yaml
Finally read user settings from /home/foobar/.config/dnfdragora.yaml
Logging disabled
<_M_> [ui] YUILoader.cc:50 loadUI(): DISPLAY: ":0"

I use dnfdragora-2.1.0-2.fc32 which contains patch for #168.

anaselli commented 4 years ago

Do you have the skill to test it with a new version of pystray by any chance? I unfortunately i cannot do any investigations in the very short time...

anaselli commented 4 years ago

And please enable logging that could help :)

szpak commented 4 years ago

Here's the logging:

2020-10-09 17:40:45,386 [dnfdragora.updater]{updater.py:67}(INFO) dnfdragora-updater started
2020-10-09 17:40:45,444 [dnfdragora.updater]{updater.py:83}(DEBUG) Icon: /usr/share/icons/hicolor/256x256/apps/dnfdragora.png
2020-10-09 17:40:45,451 [PIL.PngImagePlugin]{PngImagePlugin.py:141}(DEBUG) STREAM b'IHDR' 16 13
2020-10-09 17:40:45,451 [PIL.PngImagePlugin]{PngImagePlugin.py:141}(DEBUG) STREAM b'pHYs' 41 9
2020-10-09 17:40:45,451 [PIL.PngImagePlugin]{PngImagePlugin.py:141}(DEBUG) STREAM b'sRGB' 62 1
2020-10-09 17:40:45,451 [PIL.PngImagePlugin]{PngImagePlugin.py:141}(DEBUG) STREAM b'gAMA' 75 4
2020-10-09 17:40:45,451 [PIL.PngImagePlugin]{PngImagePlugin.py:141}(DEBUG) STREAM b'IDAT' 91 31749
2020-10-09 17:40:45,824 [PIL.PngImagePlugin]{PngImagePlugin.py:141}(DEBUG) STREAM b'IHDR' 16 13
2020-10-09 17:40:45,824 [PIL.PngImagePlugin]{PngImagePlugin.py:141}(DEBUG) STREAM b'bKGD' 41 6
2020-10-09 17:40:45,824 [PIL.PngImagePlugin]{PngImagePlugin.py:583}(DEBUG) b'bKGD' 41 6 (unknown)
2020-10-09 17:40:45,824 [PIL.PngImagePlugin]{PngImagePlugin.py:141}(DEBUG) STREAM b'IDAT' 59 2296
2020-10-09 17:40:45,983 [dnfdaemon.client]{dnfd_client.py:214}(DEBUG) org.baseurl.DnfSystem daemon loaded - version :  2
2020-10-09 17:40:45,984 [dnfdragora.updater]{updater.py:282}(DEBUG) Start getting updates
2020-10-09 17:40:45,984 [dnfdaemon.client]{dnfd_client.py:362}(DEBUG) run_dbus_async Lock
2020-10-09 17:40:45,984 [dnfdaemon.client]{dnfd_client.py:340}(DEBUG) __async_thread_loop Command Lock() requested 
2020-10-09 17:40:45,985 [dnfdragora.updater]{updater.py:380}(INFO) Scheduled check for updates in 180 minutes
2020-10-09 17:40:47,018 [dnfdaemon.client]{dnfd_client.py:270}(DEBUG) return_handler Lock
2020-10-09 17:40:47,018 [dnfdaemon.client]{dnfd_client.py:292}(DEBUG) get_result Lock
2020-10-09 17:40:47,018 [dnfdaemon.client]{dnfd_client.py:283}(DEBUG) Quit return_handler error None
2020-10-09 17:40:47,487 [dnfdragora.updater]{updater.py:316}(INFO) Event received Lock - info {'result': True, 'error': None}
2020-10-09 17:40:47,487 [dnfdaemon.client]{dnfd_client.py:362}(DEBUG) run_dbus_async GetPackages
2020-10-09 17:40:47,487 [dnfdaemon.client]{dnfd_client.py:340}(DEBUG) __async_thread_loop Command GetPackages(('(sas)', 'updates_all', [])) requested 
2020-10-09 17:40:47,488 [dnfdragora.updater]{updater.py:320}(DEBUG) Getting update packages
2020-10-09 17:40:49,728 [dnfdaemon.client]{dnfd_client.py:270}(DEBUG) return_handler GetPackages
2020-10-09 17:40:49,728 [dnfdaemon.client]{dnfd_client.py:292}(DEBUG) get_result GetPackages
2020-10-09 17:40:49,728 [dnfdaemon.client]{dnfd_client.py:283}(DEBUG) Quit return_handler error None
2020-10-09 17:40:49,990 [dnfdragora.updater]{updater.py:329}(DEBUG) Got GetPackages event menu visibility is True
2020-10-09 17:40:49,991 [dnfdragora.updater]{updater.py:334}(DEBUG) Event received GetPackages
2020-10-09 17:40:49,991 [dnfdragora.updater]{updater.py:338}(INFO) Found 1 updates

However, the exception is logged only in terminal (and hopefully in the system logs if executed at the system start). Maybe it would be good to add it also to the application log?

szpak commented 4 years ago

Do you have the skill to test it with a new version of pystray by any chance?

Do you mean 0.17.0/1?

Is pystray responsible for creating /tmp/tmpd9ew4mco?

szpak commented 4 years ago

With 0.17.1 it works fine - I see the updates again. I will ask the Fedora maintainer to bump the version.

Closing this issue, but you could mention in the changelog that 0.17(.0?) is required to see the notifications (at least in Gnome).

anaselli commented 4 years ago

Do you have the skill to test it with a new version of pystray by any chance?

Do you mean 0.17.0/1?

Yes i saw they worked on gtk backend

Is pystray responsible for creating /tmp/tmpd9ew4mco?

Yes, it create an image from icon and then uses it.

anaselli commented 4 years ago

With 0.17.1 it works fine - I see the updates again. I will ask the Fedora maintainer to bump the version.

Thanks for the tests, that avoided me a lot of testing with the version we're using now :) And tests to see if worked well fixing issues.

Closing this issue, but you could mention in the changelog that 0.17(.0?) is required to see the notifications (at least in Gnome).

Yes we'll add a version dependency on README in next release. But now i can do more tests on hiding/showing icon :) Thanks for report and tests :+1: