Bug 350785 - Infinit loop when running apps using legacy systray
Summary: Infinit loop when running apps using legacy systray
Status: RESOLVED FIXED
Alias: None
Product: frameworks-knotifications
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Martin Klapetek
URL:
Keywords:
: 350255 350288 352881 362863 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-07-30 10:48 UTC by Sergio Martins
Modified: 2024-12-18 17:13 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.10
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergio Martins 2015-07-30 10:48:08 UTC
I have recent master of kdepim + kf5, when running on plasma4 (uses legacy systray) app freezes due to infinite loop, with this backtrace:

#342 0x00007ffff27e70dd in KStatusNotifierItemPrivate::registerToDaemon (this=0x7fffdec63d00) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:744
#343 0x00007ffff27e3489 in KStatusNotifierItemPrivate::init (this=0x7fffdec63d00, extraId=...) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:722
#344 0x00007ffff27e2e00 in KStatusNotifierItem::KStatusNotifierItem (this=0x7fffded410e0, parent=<optimized out>) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:55
#345 0x00007fffdadf2870 in KDEPlatformSystemTrayIcon::init (this=0x7fffdece20a0) at /data/extra2/sources/kf5/kdelibs-frameworks/frameworkintegration/src/platformtheme/kdeplatformsystemtrayicon.cpp:270
#346 0x00007fffeed41b84 in QSystemTrayIconPrivate::install_sys_qpa (this=this@entry=0x7fffded6bd80) at util/qsystemtrayicon.cpp:684
#347 0x00007fffeed5fcce in QSystemTrayIconPrivate::install_sys (this=this@entry=0x7fffded6bd80) at util/qsystemtrayicon_x11.cpp:262
#348 0x00007fffeed41705 in QSystemTrayIcon::setVisible (this=<optimized out>, visible=<optimized out>) at util/qsystemtrayicon.cpp:271
#349 0x00007ffff27e5ecb in QSystemTrayIcon::show (this=0x2e) at /data/extra2/installation/qt/x86_64-dev/include/QtWidgets/qsystemtrayicon.h:95
#350 KStatusNotifierItemPrivate::setLegacySystemTrayEnabled (this=0x7fffdec63580, enabled=<optimized out>) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:808
#351 0x00007ffff27e70dd in KStatusNotifierItemPrivate::registerToDaemon (this=0x7fffdec63580) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:744
#352 0x00007ffff27e3489 in KStatusNotifierItemPrivate::init (this=0x7fffdec63580, extraId=...) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:722

#353 0x00007ffff27e2e00 in KStatusNotifierItem::KStatusNotifierItem (this=0x7fffdeccd280, parent=<optimized out>) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:55

(repeats)

#354 0x00007fffdadf2870 in KDEPlatformSystemTrayIcon::init (this=0x7fffdece2320) at /data/extra2/sources/kf5/kdelibs-frameworks/frameworkintegration/src/platformtheme/kdeplatformsystemtrayicon.cpp:270

#355 0x00007fffeed41b84 in QSystemTrayIconPrivate::install_sys_qpa (this=this@entry=0x7fffded6ba80) at util/qsystemtrayicon.cpp:684

#356 0x00007fffeed5fcce in QSystemTrayIconPrivate::install_sys (this=this@entry=0x7fffded6ba80) at util/qsystemtrayicon_x11.cpp:262

#357 0x00007fffeed41705 in QSystemTrayIcon::setVisible (this=<optimized out>, visible=<optimized out>) at util/qsystemtrayicon.cpp:271

#358 0x00007ffff27e5ecb in QSystemTrayIcon::show (this=0x2e) at /data/extra2/installation/qt/x86_64-dev/include/QtWidgets/qsystemtrayicon.h:95


#359 KStatusNotifierItemPrivate::setLegacySystemTrayEnabled (this=0x7fffdec62cc0, enabled=<optimized out>) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:808

#360 0x00007ffff27e70dd in KStatusNotifierItemPrivate::registerToDaemon (this=0x7fffdec62cc0) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:744

#361 0x00007ffff27e3489 in KStatusNotifierItemPrivate::init (this=0x7fffdec62cc0, extraId=...) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:722

#362 0x00007ffff27e2e00 in KStatusNotifierItem::KStatusNotifierItem (this=0x7fffdecb91f0, parent=<optimized out>) at /data/extra2/sources/kf5/kdelibs-frameworks/knotifications/src/kstatusnotifieritem.cpp:55


Reproducible: Always

Steps to Reproduce:
Start korgac, or kmail after enabling systray



Qt 5.6 (dev branch)
Comment 1 Martin Klapetek 2015-07-31 11:51:35 UTC
Thanks for the report

> plasma4 (uses legacy systray)

What do you mean by legacy systray? Is it the standard shipped one? Or something else? Cause the normal systray in plasma4 shouldn't be the "legacy" one afair.

Furthermore, there is a systray availability check in frameworksintegration, can you check you have that QPA plugin installed and loaded?
Comment 2 Sergio Martins 2015-07-31 18:59:48 UTC
By legacy, I mean whatever is meant by: KStatusNotifierItemPrivate::setLegacySystemTrayEnabled()

Which probably means xembed tray icons ?

Yes, looks like I have the plugin installed: KDEPlatformSystemTrayIcon::init() appears in the backtrace

To read the backtrace, better start from the bottom, the frames from 362 to 354 are the block that repeats

Creating a KStatusNotifierItem() triggers creation of a QSystemTrayIcon::show() which triggers KDEPlatformSystemTrayIcon::init() which triggers another creation of KStatusNotifierItem() and so forth
Comment 3 Martin Klapetek 2015-09-18 18:32:25 UTC
*** Bug 352881 has been marked as a duplicate of this bug. ***
Comment 4 Jonathan Marten 2015-09-19 07:19:45 UTC
*** Bug 350255 has been marked as a duplicate of this bug. ***
Comment 5 Sven Brauch 2015-11-30 23:27:45 UTC
The code which "triggers" this bug is in qgenericunixservices.cpp in Qt. I'll just paste it here for future reference:

static inline QByteArray detectDesktopEnvironment()
{
    const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP");
    if (!xdgCurrentDesktop.isEmpty())
        return xdgCurrentDesktop.toUpper(); // KDE, GNOME, UNITY, LXDE, MATE, XFCE...

    // Classic fallbacks
    if (!qEnvironmentVariableIsEmpty("KDE_FULL_SESSION"))
        return QByteArrayLiteral("KDE");
    if (!qEnvironmentVariableIsEmpty("GNOME_DESKTOP_SESSION_ID"))
        return QByteArrayLiteral("GNOME");

    // Fallback to checking $DESKTOP_SESSION (unreliable)
    const QByteArray desktopSession = qgetenv("DESKTOP_SESSION");
    if (desktopSession == "gnome")
        return QByteArrayLiteral("GNOME");
    if (desktopSession == "xfce")
        return QByteArrayLiteral("XFCE");

    return QByteArrayLiteral("UNKNOWN");
}

Check if you have KDE_FULL_SESSION set, or XDG_CURRENT_DESKTOP set to KDE. If that is the case, then the KDE platform integration is loaed which triggers this issue.
Comment 6 Sven Brauch 2015-11-30 23:28:04 UTC
Neverthereless, KDE code should handle this fault condition more gracefully.
Comment 7 Thomas Lübking 2015-12-06 14:52:00 UTC
*** Bug 350288 has been marked as a duplicate of this bug. ***
Comment 8 Sven Brauch 2015-12-07 17:47:43 UTC
Should be "fixed" (as in, it does no longer crash but print a warning) by commit b45544f3d4dd9 in knotifications (sorry, got the bug number wrong)
Comment 9 Thomas Lübking 2015-12-07 21:34:29 UTC
Looks good reg. bug #350288 (ie. I can confirm the fix) - thanksalot.
Comment 10 Martin Flöser 2016-05-10 05:59:43 UTC
*** Bug 362863 has been marked as a duplicate of this bug. ***
Comment 11 Balló György 2024-07-14 15:03:43 UTC
The commit b45544f3d4dd9 is not a proper fix, because if the if the 'QT_QPA_PLATFORMTHEME=kde' is set outside of KDE session and the 'org.kde.StatusNotifierWatcher' D-Bus interface is unavailable or gone, the infinite loop still happens.
Comment 12 Bug Janitor Service 2024-07-14 16:58:03 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kstatusnotifieritem/-/merge_requests/16
Comment 13 Bug Janitor Service 2024-07-14 16:58:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/knotifications/-/merge_requests/149
Comment 14 Balló György 2024-12-18 17:09:44 UTC
Git commit 1683edad6907bcce8a233acb09241ab33f5ce429 by György Balló.
Committed on 16/12/2024 at 16:07.
Pushed by davidedmundson into branch 'kf5'.

Do not crash if KDE platform integration is loaded but SNI is unavailable

Checking for the KDE session is not enough as the KDE platform integration can be used
outside of KDE if the QT_QPA_PLATFORMTHEME environment variable is set to 'kde'.

M  +4    -3    src/kstatusnotifieritem.cpp

https://invent.kde.org/frameworks/knotifications/-/commit/1683edad6907bcce8a233acb09241ab33f5ce429