QT4 Tray application and CPU load in 18.04

Bug #1779663 reported by Stefan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnome-panel (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Ubuntu 18.04 LTS
Session: gnome-flashback
Tested with: gnome-panel: 3.26.0-1ubuntu5 / 3.28.0-1ubuntu1 (cosmic)

We recognized a steady CPU load of about 2% when starting our QT4 tray application. To eliminate any issues in our application, we created a minimal python qt4 tray app (attached).

As soon as this app is started, the gnome-panel process gets a CPU load of about 2%.
When stracing the gnome-panel, we recognize a repeating log pattern:

poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=6, events=POLLIN}], 3, 0) = 0 (Timeout)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{iov_base="\212\5\4\0f\26 \0\0\0\26\0\26\0\2\0\217\3\4\0U\1 \0f\26 \0\0\0\0\0"..., iov_len=40}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 40
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=6, events=POLLIN}], 3, 13) = 0 (Timeout)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{iov_base="5 \4\0g\26 \0\3\0 \0\26\0\2\0\213\4\6\0h\26 \0g\26 \0&\0\0\0"..., iov_len=236}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 236
recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="[\2\353kT\1 \0U\1 \0\200)y\0\0\0\26\0\26\0\2\0\n\5h\3\26\0\30\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=6, events=POLLIN}], 3, 0) = 0 (Timeout)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{iov_base="\212\5\4\0i\26 \0\0\0\26\0\26\0\2\0\217\3\4\0U\1 \0i\26 \0\0\0\0\0"..., iov_len=40}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 40
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=6, events=POLLIN}], 3, 13) = 0 (Timeout)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{iov_base="5 \4\0j\26 \0\3\0 \0\26\0\2\0\213\4\6\0k\26 \0j\26 \0&\0\0\0"..., iov_len=236}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 236
recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="[\2\371kT\1 \0U\1 \0\217)y\0\0\0\26\0\26\0\2\0\n\5h\3\26\0\30\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=6, events=POLLIN}], 3, 0) = 0 (Timeout)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])

The trayapp is doing nothing. Can anybody explain how to stop this behaviour in gnome-panel? Thanks!

Revision history for this message
Stefan (steffel) wrote :
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Qt 4 is no longer supported. Does it happen with Qt 5?

Changed in gnome-panel (Ubuntu):
status: New → Invalid
Changed in gnome-panel (Ubuntu):
status: Invalid → Incomplete
Revision history for this message
Stefan (steffel) wrote :

Tried the same python minimal application with pyqt5 (qt 5.9.5) - and no, it does not happen.

So it seems to be a QT4 problem somehow in connection to the gnome-panel, because this does not happen with the same QT4 application and fbpanel in the same environment.

stracing the gnome-panel with this pyqt5 app, a similar output is logged, but not as frequent as with qt4:

restart_syscall(<... resuming interrupted poll ...>) = 1
recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\34\0\260\202\275\2\0\0\21\2\0\0:\201\247\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=6, events=POLLIN}], 3, -1) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\34\0\260\202\275\2\0\0\21\2\0\0R\324\247\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=6, events=POLLIN}], 3, -1

I attached the pyqt5 tray app if somebody wants to take a look at that.
But the CPU load disappears with QT5.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

I think it is a bug in sni-qt that sends too many events to gnome-panel. Other panels like fbpanel do not use indicators so the X11 tray is used there, which does not have the issue.

sni-qt is also unmaintained so I doubt that this will be fixed.

You can use the X11 tray with gnome-panel too, by removing sni-qt package and adding “Notification area” applet to the panel.

If you want to further debug the issue, output of dbus-monitor may be more interesting than strace output.

Revision history for this message
Stefan (steffel) wrote :
Download full text (9.7 KiB)

I thought, the QSystemTrayIcon is in the notification area, automatically. Because we have this area activated and it only appears within this area.

Here ist the output of dbus-monitor:

QT4 app:

method call time=1530618711.195260 sender=:1.901 -> destination=org.freedesktop.DBus serial=1 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=Hello
method return time=1530618711.195277 sender=org.freedesktop.DBus -> destination=:1.901 serial=1 reply_serial=1
   string ":1.901"
signal time=1530618711.195283 sender=org.freedesktop.DBus -> destination=(null destination) serial=5 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.901"
   string ""
   string ":1.901"
signal time=1530618711.195291 sender=org.freedesktop.DBus -> destination=:1.901 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.901"
method call time=1530618711.195759 sender=:1.901 -> destination=org.freedesktop.DBus serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',member='NameOwnerChanged',arg0='org.gnome.GConf'"
method call time=1530618711.199344 sender=:1.901 -> destination=org.freedesktop.DBus serial=3 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='method_call',interface='org.gnome.GConf.Database',member='Notify'"
method call time=1530618711.199795 sender=:1.901 -> destination=org.freedesktop.DBus serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',interface='org.gnome.GConf.Server',member='Bye'"
method call time=1530618711.200079 sender=:1.901 -> destination=org.freedesktop.DBus serial=5 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',member='Disconnected'"
method call time=1530618711.200335 sender=:1.901 -> destination=org.freedesktop.DBus serial=6 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=StartServiceByName
   string "org.gnome.GConf"
   uint32 0
method return time=1530618711.200347 sender=org.freedesktop.DBus -> destination=:1.901 serial=3 reply_serial=6
   uint32 2
method call time=1530618711.200694 sender=:1.901 -> destination=org.gnome.GConf serial=7 path=/org/gnome/GConf/Server; interface=org.gnome.GConf.Server; member=GetDefaultDatabase
method return time=1530618711.200704 sender=:1.79 -> destination=:1.901 serial=217 reply_serial=7
   object path "/org/gnome/GConf/Database/0"
method call time=1530618711.200822 sender=:1.901 -> destination=org.gnome.GConf serial=8 path=/org/gnome/GConf/Database/0; interface=org.gnome.GConf.Database; member=LookupExtended
   string "/desktop/gnome/interface/menus_have_icons"
   string "en_US.UTF-8"
   boolean true
method return time=1530618711.200836 sender=:1.79 -> destination=:1.901 serial=218 reply_serial=8
   struct {
      string "/desktop/gnome/interface/menus_have_icons"
      struct {
         int32 4
         boolean false
      }
      boolean true
      string "/schemas/desktop/gnome/interface/menus_have_icons"
      boolean true
      boolean true
   }
signal time=1530618711...

Read more...

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

> Could not get owner of name 'org.kde.StatusNotifierWatcher': no such name

Oh, it looks like I was wrong then.

There are two ways to get icons in the panel: via indicator-application and via the old X11 tray.

The indicator-based tray is default if you have the standard panel configuration (with indicator-applet added to the panel). But it looks like you don’t have it, so the X11 tray is used instead.

You can try adding indicator-applet to the panel and see if this helps.

Revision history for this message
Stefan (steffel) wrote :

It was not a big task to convert my application to a qt5 app, which I did this afternoon. The CPU load is gone, now, and for me, this is the solution to my problem.

I appreciate your help, thanks!

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for gnome-panel (Ubuntu) because there has been no activity for 60 days.]

Changed in gnome-panel (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.