Mattermost continuously updates its application menu without need #5088

Closed
kbroulik opened this Issue Jan 17, 2017 · 3 comments

Comments

Projects
None yet
4 participants

Summary

Mattermost continuously updates its application menu causing DBus spam

Steps to reproduce

Run Mattermost on a platform which supports global menu (like Plasma 5.9 Beta or potentially Unity). Run Mattermost and observe the output of dbus-monitor. (Mattermost version 3.4.1)

Expected behavior

Only when the menu really changes the application signals a change. For simplicity this could also be done when the window gets focused or another conversation is opened.

Observed behavior

Mattermost signals ItemsPropertiesUpdated and LayoutUpdated for the root menu which in turn will have the global menu service emit AboutToShow on the submenus (this is needed for certain applications like Firefox to work properly) which in turn will do a GetLayout and then it starts all over again. Mattermost is the only application I noticed to exert this behavior, none of the other applications do and neither does the Chrome browser. See [1] below for dbus-monitor output.

Possible fixes

The mattermost code is as follows

  // Set application menu
  ipcMain.on('update-menu', (event, config) => {
    var app_menu = appMenu.createMenu(mainWindow, config);
    Menu.setApplicationMenu(app_menu);
        […]
  });
  ipcMain.emit('update-menu', true, config);

As you can see it constantly emits a the update-menu signal which in turn will do setApplicationMenu thus eventually signalling a change.

[1] snippet from dbus-monitor output (goes on forever)

method call time=1484645679.043942 sender=:1.965 -> destination=:1.973 serial=29915 path=/com/canonical/menu/6600001; interface=com.canonical.dbusmenu; member=GetLayout
   int32 0
   int32 1
   array [
   ]
method return time=1484645679.044099 sender=:1.973 -> destination=:1.965 serial=12408 reply_serial=29915
   uint32 93672
   struct {
      int32 0
      array [
         dict entry(
            string "children-display"
            variant                string "submenu"
         )
         dict entry(
            string "label"
            variant                string "Root"
         )
      ]
      array [
         variant             struct {
               int32 2
               array [
                  dict entry(
                     string "children-display"
                     variant                         string "submenu"
                  )
                  dict entry(
                     string "label"
                     variant                         string "_File"
                  )
               ]
               array [
               ]
            }
         variant             struct {
               int32 3
               array [
                  dict entry(
                     string "children-display"
                     variant                         string "submenu"
                  )
                  dict entry(
                     string "label"
                     variant                         string "_Edit"
                  )
               ]
               array [
               ]
            }
         variant             struct {
               int32 4
               array [
                  dict entry(
                     string "children-display"
                     variant                         string "submenu"
                  )
                  dict entry(
                     string "label"
                     variant                         string "_View"
                  )
               ]
               array [
               ]
            }
         variant             struct {
               int32 5
               array [
                  dict entry(
                     string "children-display"
                     variant                         string "submenu"
                  )
                  dict entry(
                     string "label"
                     variant                         string "_History"
                  )
               ]
               array [
               ]
            }
         variant             struct {
               int32 6
               array [
                  dict entry(
                     string "children-display"
                     variant                         string "submenu"
                  )
                  dict entry(
                     string "label"
                     variant                         string "_Window"
                  )
               ]
               array [
               ]
            }
         variant             struct {
               int32 7
               array [
                  dict entry(
                     string "children-display"
                     variant                         string "submenu"
                  )
                  dict entry(
                     string "label"
                     variant                         string "_Help"
                  )
               ]
               array [
               ]
            }
      ]
   }
method call time=1484645679.044244 sender=:1.965 -> destination=:1.973 serial=29916 path=/com/canonical/menu/6600001; interface=com.canonical.dbusmenu; member=AboutToShow
   int32 2
method call time=1484645679.044266 sender=:1.965 -> destination=:1.973 serial=29917 path=/com/canonical/menu/6600001; interface=com.canonical.dbusmenu; member=AboutToShow
   int32 3
method call time=1484645679.044281 sender=:1.965 -> destination=:1.973 serial=29918 path=/com/canonical/menu/6600001; interface=com.canonical.dbusmenu; member=AboutToShow
   int32 4
method call time=1484645679.044284 sender=:1.965 -> destination=:1.973 serial=29919 path=/com/canonical/menu/6600001; interface=com.canonical.dbusmenu; member=AboutToShow
   int32 5
method call time=1484645679.044289 sender=:1.965 -> destination=:1.973 serial=29920 path=/com/canonical/menu/6600001; interface=com.canonical.dbusmenu; member=AboutToShow
   int32 6
method call time=1484645679.044297 sender=:1.965 -> destination=:1.973 serial=29921 path=/com/canonical/menu/6600001; interface=com.canonical.dbusmenu; member=AboutToShow
   int32 7
method return time=1484645679.044435 sender=:1.973 -> destination=:1.965 serial=12409 reply_serial=29916
   boolean false
method return time=1484645679.044537 sender=:1.973 -> destination=:1.965 serial=12410 reply_serial=29917
   boolean false
method return time=1484645679.044547 sender=:1.973 -> destination=:1.965 serial=12411 reply_serial=29918
   boolean false
method return time=1484645679.044574 sender=:1.973 -> destination=:1.965 serial=12412 reply_serial=29919
   boolean false
method return time=1484645679.044744 sender=:1.973 -> destination=:1.965 serial=12413 reply_serial=29920
   boolean false
method return time=1484645679.044769 sender=:1.973 -> destination=:1.965 serial=12414 reply_serial=29921
   boolean false
signal time=1484645679.045117 sender=:1.973 -> destination=(null destination) serial=12415 path=/com/canonical/menu/6600001; interface=com.canonical.dbusmenu; member=LayoutUpdated
   uint32 93740
   int32 0
signal time=1484645679.045172 sender=:1.973 -> destination=(null destination) serial=12416 path=/com/canonical/menu/6600001; interface=com.canonical.dbusmenu; member=ItemsPropertiesUpdated
   array [
      struct {
         int32 2
         array [
            dict entry(
               string "children-display"
               variant                   string "submenu"
            )
         ]
      }
      struct {
         int32 3
         array [
            dict entry(
               string "children-display"
               variant                   string "submenu"
            )
         ]
      }
      struct {
         int32 4
         array [
            dict entry(
               string "children-display"
               variant                   string "submenu"
            )
         ]
      }
      struct {
         int32 5
         array [
            dict entry(
               string "children-display"
               variant                   string "submenu"
            )
         ]
      }
      struct {
         int32 6
         array [
            dict entry(
               string "children-display"
               variant                   string "submenu"
            )
         ]
      }
      struct {
         int32 7
         array [
            dict entry(
               string "children-display"
               variant                   string "submenu"
            )
         ]
      }
   ]
   array [
   ]
method call time=1484645679.045260 sender=:1.965 -> destination=:1.973 serial=29922 path=/com/canonical/menu/6600001; interface=com.canonical.dbusmenu; member=GetLayout
   int32 0
   int32 1
   array [
   ]
Contributor

lfbrock commented Jan 23, 2017

Hi @kbroulik - we're not very familiar with DBus, were any of the other applications you used built with React? Not sure if that could cause the difference.

If there's suggestions you have for what the code should be changed to, we're open to discussing them

Contributor

jasonblais commented Jan 30, 2017

We haven't received an update so we'll assume that the problem is fixed or is no longer valid.

If you still experience the same problem, try upgrading to the latest version.

If the issue persists, reopen this issue with the relevant information and we'd be glad to help you where we can.

@jasonblais jasonblais closed this Jan 30, 2017

ChALkeR commented Feb 11, 2017

Upstream bugreport: electron/electron#8455

@ChALkeR ChALkeR referenced this issue in electron/electron Feb 11, 2017

Closed

Globalmenu consumes 100% CPU and does not work #8455

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment