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

Segfault at startup under Plasma Wayland #500

Closed
nicolamori opened this issue Feb 27, 2022 · 20 comments
Closed

Segfault at startup under Plasma Wayland #500

nicolamori opened this issue Feb 27, 2022 · 20 comments
Labels
bug Something isn't working

Comments

@nicolamori
Copy link

OS: Archlinux
Linux Desktop Manager: KDE Plasma on Wayland
Birdtray version: 1.9.0
Thunderbird version: 91.6.1
Birdtray origin: Built from Archlinux's AUR
Qt version: 5.15.2+kde+r302-1 as shipped by official Archlinux repositories

Description
Starting Birdtray manually from console I just get a segfault:

$ birdtray 
Segmentation fault (core dumped)

Stack trace:

Stack trace of thread 17700:
#0  0x00007f18ea5b3d0a XQueryTree (libX11.so.6 + 0x37d0a)
#1  0x000055975003d14c findWindow (birdtray + 0x6514c)
#2  0x000055975003dba3 _ZN15WindowTools_X116lookupEv (birdtray + 0x65ba3)
#3  0x00005597500266ca _ZN8TrayIcon11updateStateEv (birdtray + 0x4e6ca)
#4  0x0000559750026e3f _ZN8TrayIconC2Eb (birdtray + 0x4ee3f)
#5  0x000055975003bcdb _ZN11BirdtrayAppC2ERiPPc (birdtray + 0x63cdb)
#6  0x0000559750000b64 main (birdtray + 0x28b64)
#7  0x00007f18ea15e310 __libc_start_call_main (libc.so.6 + 0x2d310)
#8  0x00007f18ea15e3c1 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x2d3c1)
#9  0x0000559750000c05 _start (birdtray + 0x28c05)

Stack trace of thread 17704:
#0  0x00007f18ea1bb15a __futex_abstimed_wait_common (libc.so.6 + 0x8a15a)
#1  0x00007f18ea1bdc64 pthread_cond_timedwait@@GLIBC_2.3.2 (libc.so.6 + 0x8cc64)
#2  0x00007f18ea7abcb4 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt5Core.so.5 + 0xebcb4)
#3  0x00007f18ea7a8b77 n/a (libQt5Core.so.5 + 0xe8b77)
#4  0x00007f18ea7a48bc n/a (libQt5Core.so.5 + 0xe48bc)
#5  0x00007f18ea1be5c2 start_thread (libc.so.6 + 0x8d5c2)
#6  0x00007f18ea243584 __clone (libc.so.6 + 0x112584)

Stack trace of thread 17717:
#0  0x00007f18ea243576 __clone (libc.so.6 + 0x112576)
#1  0x00007ffca87350f0 n/a (n/a + 0x0)

Expected behavior
Birdtray should at least start.

To Reproduce

  1. Start a Plasma Wayland session
    2.Launch Birdtray manually

Additional context
AFAIK Birdtray it is not supported on Wayland (#426) but according to this comment it should work with limited functionality at least in other Wayland sessions like Gnome. So I guess the problem is related to the Plasma Wayland session.

@nicolamori nicolamori added the bug Something isn't working label Feb 27, 2022
@ladar
Copy link

ladar commented Jun 29, 2022

@nicolamori I made a mention on #434, but was wondering if the snapshot provided by that PR worked for you? It purports to have been created for Qt 5.15.1 so it may have fixed your issue.

I don't use Plasma all that much these days, but I'd like to see it working, because it should help with #500 ... there is an overabundance of Fedora packages that segfault already, if someone is using a an incompatible Window Manager+Compositor combo.

@nicolamori
Copy link
Author

@ladar the PR code partially works under a Wayland session of Plasma 5.25.2 with Qt 5.15.10. No segfault, but birdtray seems partially unable to detect Thunderbird running: it constantly displays a red cross over the tray icon but is able to restart Thunderbird when I close it. This happens both for native Wayland and for XWayland Thunderbird.

@Abestanis
Copy link
Collaborator

@nicolamori This might be because that branch was a bit outdated and based on a version of Birdtray from November 2020. I think commit ff65c93 might address the issue your describing, but I'm not sure.

I have rebased the branch on the latest version of Birdtray, let us know if anything changes if you try it again.

@ladar
Copy link

ladar commented Jun 29, 2022

@nicolamori juat to be clear, the HEAD revision crashes, but the PR code runs, it just doesn't detect Thunerbird?

I can make a complete guess on that issue. If you install the wmctrl utility, and then run:

wmctrl -l

You'll get a list of running apps and their respective window titles. The Thunderbird window should end with - Mozilla Thunderbird ... which should match what you find in the Thunderbird window name pattern field, on the advanced tab, of the birdtray settings.

If for some reason, that string is different, or it can't read the window names, then that would explain why it isn't detecting Thunderbird. Either because that info isn't available on your system because of how it's setup, or perhaps the window naming convention was tweaked for the Thunerbird version your using (either because its new or because of how it was built).

This is all just a guess though.

In your original post you mention version 5.15.2. Are you no longer using that version? I was noticed this issue, because RHEL 9 uses that version, and Fedora 36 is on 5.15.3 and I was worried there was a crashing bug.

@nicolamori
Copy link
Author

I built the rebased branch but I still get the same behavior. I also tried with wmctrl and this is what I get:

0x01000056  0 stryke Inbox - my@email.address - Mozilla Thunderbird

so it is consistent with the Birdtray settings. I also tried to set the suffix to one of another running window, to no avail. It is interesting to note that wmctrl seems to detect only XWayland windows, and does not display native Wayland ones (also Thunderbird when started in Wayland native mode). Anyway I tried both modes and Birdtray still displays the red cross.

About the Qt version: I run Arch and Qt has been updated since I opened the issue.

@ladar
Copy link

ladar commented Jun 29, 2022

@nicolamori I have an idea. If you open up a terminal window, I'm guessing:

QT_QPA_PLATFORM=wayland birdtray 

Will result in the behavior you described above. On ther other hand, if you run:

XDG_SESSION_TYPE=wayland birdtray

It might just work. I'm assuming your compositor is Wayland of course.

P.S. If it doesn't work, chekc your environment variables and make sure QT_QPA_PLATFORM and XDG_SESSION_TYPE aren't already being setup. If they are make sure you unset whichever one you aren't testing during a given trial.

@nicolamori
Copy link
Author

@ladar I already have XDG_SESSION_TYPE set to wayland in my environment:

$ echo $XDG_SESSION_TYPE
wayland

and QT_QPA_PLATFORM is not set. So I guess that all my previous tests should have worked, right? I'm in a Plasma Wayland session, so the compositor is wayland

@ladar
Copy link

ladar commented Jun 29, 2022

On Gnome, if I use QT_QPA_PLATFORM it can't find Thunderbird, like you described. And with XDG it works. Perhaps things are reversed because you're running Plasma?

@nicolamori
Copy link
Author

No joy, I tried with QT_QPA_PLATFORM=wayland birdtray but I got the same behavior. Maybe some other Plasma user should try, to rule out any possible mistake from my side.

@ladar
Copy link

ladar commented Jun 29, 2022

I don't have Plasma installed on the notebook with me, and I don't like to use this one for dev/testing. I have a Fedora 36 dev machine at home. I can use that to test this out next week, when I should have more time.

@nicolamori
Copy link
Author

Ok, please let me know if there is anything else useful that I can do. And thanks for your efforts!

@ladar
Copy link

ladar commented Jun 29, 2022

Just an FYI, another user gave the HEAD commit a try using Fedora 36, and Plasma, and it segfaulted. I pointed him here, and tried to summarize. in case he has time to look into this before me.

https://bugzilla.redhat.com/show_bug.cgi?id=1989943

@ladar
Copy link

ladar commented Jun 29, 2022

I should probably mention in both places. If you do play around with this more, you should probably run birdtray via the console. I also think there might environent variables you can tweak that will cause the QT libs to output more info/warnings. You can also try using XDG_CURRENT_DESKTOP=KDE standalone and/or with the QT var I mentioned above.

@ladar
Copy link

ladar commented Jun 29, 2022

It also just occurred to me. You should check the systemd journal. It might contain a clue as well. I think new versions of QT log messages there by default. See the QT_LOGGING_RULES and QT_MESSAGE_PATTERN ...

@ladar
Copy link

ladar commented Jun 29, 2022

@nicolamori this could be the default, but can you also try running it with

env DESKTOP_SESSION=plasma XDG_CURRENT_DESKTOP=KDE birdtray

It worked for me that way, although gain that was with a Gnome desktop. You can also experiment with various QT platform plugins like so.

env DESKTOP_SESSION=plasma XDG_CURRENT_DESKTOP=KDE QT_QPA_PLATFORM=wayland birdtray

Substitute wayland with other plugins. Some possibilities are: eglfs, linuxfb, minimal, minimalegl,, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx and more (or less) depending on what you have installed.

@nicolamori
Copy link
Author

@ladar I already have XDG_CURRENT_DESKTOP=KDE and DESKTOP_SESSION=plasmawayland in my default environment. I also tried with DESKTOP_SESSION=plasma and QT_QPA_PLATFORM=wayland-egl (other options didn't work or crashed Thunderbird), nothing worked.

@aerfanr
Copy link

aerfanr commented Jun 30, 2022

I tested this with Qt version 5.15.5 and it did not work. I also tried setting DESKTOP_SESSION=plasma, XDG_CURRENT_DESKTOP=KDE and DESKTOP_SESSION=plasma and none of them worked.

@gyunaev
Copy link
Owner

gyunaev commented Sep 19, 2022

Basically the whole x11 stuff should not be used on Wayland.

@MaceWindu
Copy link

@gyunaev, could you please release 1.9.1 with this fix included?

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1024256#10 for context (Debian ships 1.9.0 which is unusable in wayland...)

@Hufschmidt
Copy link

Hufschmidt commented Apr 28, 2023

Having the same issue, but running birdtray 1.9.0 with QT_QPA_PLATFORM=xcb birdtray seems to work just now.

  • Birdtray launched
  • Birdtray detects number of unread mails
  • Birdtray can open and close (minimize/maximize) thunderbird process

Side-Note: I did start thunderbird (without any QT_QPA_PLATFORM) before starting Birdtray though, maybe it will not work when birdtray starts thunderbird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants