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

Linux XFCE submenu empty #12

Open
mrpalide opened this issue May 10, 2022 · 25 comments
Open

Linux XFCE submenu empty #12

mrpalide opened this issue May 10, 2022 · 25 comments

Comments

@mrpalide
Copy link

mrpalide commented May 10, 2022

Hey there!
We have an app that use systray, and now I want to submit this report as issue.
On Gnome works like a charm. But XFCE is unstable in submenu!, and KDE Plasma is really strange and useless on submenus.
You can see bellow screencasts:

Screen Cast

Ubuntu

OS: Ubuntu 22.04 (Minimal Installation)
Desktop: Gnome 42.0

ubuntu2204.mp4

Nitrux (Debianbased)

OS: Nitrux 2.1.1
Desktop: KDE Plasma 5.24.4

nitrux.mov

Manjaro (Archbased)

OS: Manjaro 21.2.6
Desktop: XFCE

manjaro.mov
@andydotxyz
Copy link
Member

@mrpalide can you please try the fixes on #11

@mrpalide
Copy link
Author

@mrpalide can you please try the fixes on #11

I test on #11 actually.

@andydotxyz
Copy link
Member

OK thanks. Can you please test the example app in this repo and report whether the submenu appears there?

@mrpalide
Copy link
Author

I found a huge problem actually on example app!
About 100 data race actually appear on that simple example!
First built it with -race flag as go build -race example/main.go, then run it ./main.

Use Quit button on systray app to see this on console:

Quit2 now...
Exit at 2022-05-11 13:15:54.215513558 +0430 +0430 m=+4.429888999
Found 100 data race(s)

Also this is a shot of submenu problem of example app on XFCE desktop:
image

@andydotxyz
Copy link
Member

Also this is a shot of submenu problem of example app on XFCE desktop:

Can you please confirm which version of XFCE? I cannot replicate the problem with 4.16.
Be sure to also test the latest master of the systray repo :)

@mrpalide
Copy link
Author

mrpalide commented May 18, 2022

Test, and the same result. Chick this video:

test-systray.mp4

@andydotxyz
Copy link
Member

Thank you for this.
Can you please confirm if you have any plugins on or configuration regarding the panel?
I will try to build a minimal arch to see if I can replicate in the same OS, but so far I can't make it not work in this way.

@mrpalide
Copy link
Author

Hey andy, sorry for late response.
Yes, I can confirm that no plugin or configuration on panel added.

@slytomcat
Copy link

slytomcat commented May 28, 2022

Also this is a shot of submenu problem of example app on XFCE desktop:
I found such problem not only in Status Notification Plugin (that serves D-Bus org.kde.StatusNotifierWatcher in XFCE) but also in Indicator plugin (can be used via GTK+ AppIndicator API).
So, it seems (for me at least) that this problem is somewhere deeper in GTK, but not in even the panel plugins.

It appears periodically and sometimes it require 10+ restarts of example app to catch the problem.

@slytomcat
Copy link

slytomcat commented May 28, 2022

About data races - I fixed a lot of them in my fork.
It was a big problem for my project yd-go where menu is used very actively (it's updated rather often). In my case those data races even leads to paincs due to concurrent access to map objects.

@slytomcat
Copy link

slytomcat commented May 28, 2022

I also can confirm that KDE notification tray plugin always show submenu on the wrong side (partly outside the screen) during the first opening of submenu. I see such behaviour in my tests on Kubuntu 22.04 (fresh install without and with latest updates).
And from my point of view it is also not a systray issue but it's an issue of KDE notification tray plugin or problem is somewhere deeper.

@andydotxyz
Copy link
Member

About data races - I fixed a lot of them in my fork.

Great news, if you could open some pull requests I am sure they would be gladly received :).

@andydotxyz
Copy link
Member

And from my point of view it is also not a systray issue but it's an issue of KDE notification tray plugin or problem is somewhere deeper.

Agreed, we don't control how the menu will be rendered so can't fix that particular issue I think

@andydotxyz andydotxyz changed the title Linux Desktops Issues Linux XFCE submenu empty May 29, 2022
@slytomcat
Copy link

Ok. I'll do the PR with my fixes.

@slytomcat
Copy link

slytomcat commented Jun 6, 2022

The results of my investigations on the XFCE sub-menu problem.

I've made a huge amount of tests with watching over DBUS communications (using dbus-monitor).

I've found that there are only three possible scenarios leads to 3 different results of the example app work (my comments after # based on info from more detailed dbus-monitor output).

CASE 1
DBUS messages sequence: (type timestamp serial sender destination path interface member # my comment)

  • mc 1654516391.833676 5767 :1.24 :1.8050 /StatusNotifierMenu com.canonical.dbusmenu GetGroupProperties # main menu items request
  • mc 1654516391.833685 5768 :1.24 :1.8050 /StatusNotifierMenu com.canonical.dbusmenu GetGroupProperties # sub-middle items request
  • mc 1654516391.833813 5769 :1.24 :1.8050 /StatusNotifierMenu com.canonical.dbusmenu GetGroupProperties # sub-bottom items request
  • mr 1654516391.835384 9 :1.8050 :1.24 5767 # main - ok
  • mr 1654516392.086320 10 :1.8050 :1.24 5768 # sub-middle - ok
  • mr 1654516392.336698 11 :1.8050 :1.24 5769 # sub-bottom - ok

Result: both sub-middle and sub-bottom are displayed

CASE 2
DBUS messages sequence: (type timestamp serial sender destination path interface member # my comment)

  • mc 1654516527.125423 5873 :1.24 :1.8066 /StatusNotifierMenu com.canonical.dbusmenu GetGroupProperties # main items request
  • mc 1654516527.125720 5874 :1.24 :1.8066 /StatusNotifierMenu com.canonical.dbusmenu GetGroupProperties # sub-middle items request
  • mc 1654516527.126048 5875 :1.24 :1.8066 /StatusNotifierMenu com.canonical.dbusmenu GetGroupProperties # sub-bottom items request
  • mr 1654516527.128447 9 :1.8066 :1.24 5873 # main - ok
  • mr 1654516527.377435 10 :1.8066 :1.24 5875 # sub-bottom - ignored as sub-middle was not received yet
  • mr 1654516527.627785 11 :1.8066 :1.24 5874 # sub-middle - ok

Result: sub-bottom is not displayed, sub-middle is displayed

CASE 3
DBUS messages sequence: (type timestamp serial sender destination path interface member # my comment)

  • mc 1654516551.007559 5908 :1.24 :1.8072 /StatusNotifierMenu com.canonical.dbusmenu GetGroupProperties # main menu items request
  • mc 1654516551.007569 5909 :1.24 :1.8072 /StatusNotifierMenu com.canonical.dbusmenu GetGroupProperties # sub-middle items request
  • mc 1654516551.007634 5910 :1.24 :1.8072 /StatusNotifierMenu com.canonical.dbusmenu GetGroupProperties # sub-bottom items request
  • mr 1654516551.007640 9 :1.8072 :1.24 5909 # sub-middle - ignored as main was not received yet
  • mr 1654516551.260791 10 :1.8072 :1.24 5908 # main - ok
  • mr 1654516551.509457 11 :1.8072 :1.24 5910 # sub-bottom - ignored due to sub-middle ignorance

Result: neither sub-middle nor sub-bottom are displayed


So, the problem is caused by response messages sequence. The only working sequence is exact first-in-first-out.

Unfortunately there is no control on response messages sequence available at the level of systray lib. This is under the control of dbus lib.

@slytomcat
Copy link

It. seems that it it not dbus lib issue as there is no requirements in D-Bus specs to handle calls strictly in the same order as they arrived. D-Bus provides calls/response's serial numbers to sort the messages. And it's a caller task to handle responses in the right order.

I've opened the issue in the gitlab.xfce.org/panel-plugins project for fixing this problem.

@andydotxyz
Copy link
Member

Thank you so much @slytomcat - let's see what they say.
Seems to be some activity so thanks for kicking this off https://gitlab.xfce.org/xfce/xfce4-panel/-/issues/582

@slytomcat
Copy link

That's why I love the Open Source World: you 'almost always' :) can find people who can help you.

@slytomcat
Copy link

https://gitlab.xfce.org/xfce/xfce4-panel/-/issues/582 is closed as wrong working lib is not maintained any more :(

There is my simply workaround (deployed into my yd-go project):

PATH_TO_PATCH="$(go env GOMODCACHE)/$(cat go.mod | grep 'github.com/godbus/dbus/v5' | sed 's/\s*\(\S\+\) \(.*\)$/\1@\2/')"
chmod a+w $PATH_TO_PATCH
patch <conn.patch -f $PATH_TO_PATCH/conn.go

while conn.patch file contains:

@@ -432,7 +432,7 @@
 		case TypeSignal:
 			conn.handleSignal(sequence, msg)
 		case TypeMethodCall:
-			go conn.handleCall(msg)
+			conn.handleCall(msg)
 		}
 
 	}

Patching code can be added to build script like I done it here

Unfortunately I see no better solution at the moment.

BTW: there is some plans to move XFCE panel back-end to Ayatana indicator project. But Ayatana has another big issue: It dosn't support IconPixmap property of org.freedesktop.StatusNotifierItem interface.

@andydotxyz
Copy link
Member

Should we open a bug in the godbus project with this patch as the use of a goroutine is causing us problems?

@slytomcat
Copy link

godbus/dbus#327 - there is already one opened and closed later about this.

The patch is just a simplest workaround but not the fix of real issue (in libdbusmenu)

@andydotxyz
Copy link
Member

Ah yes I see, thanks for all of this.
Sadly I'm not sure that we can do anything more in this ticket then, perhaps should just close it - the docs you provide and workaround leave a nice trail for others to find

@mrpalide
Copy link
Author

So we should hide sub-menus on XFCE desktops, right? :)

@slytomcat
Copy link

@mrpalide no, you can apply the patch to the godbus for your build and sub-menus on XFCE will work fine (because your app will handle the requests from libdbusmenu in the sequense as they comes). It's not perfect solution, but it works.

@slytomcat
Copy link

C is not my favorite language but I'll try to find the problem in that lib.

Probably there is someone more experienced in C who can find and fix this issue in libdbusmenu.

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

3 participants