Bug 479010 - Inconsistent Flatpak launch behavior across Application Launcher, Krunner and Overview that often leads to the application crashing
Summary: Inconsistent Flatpak launch behavior across Application Launcher, Krunner and...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Application Launcher (Kickoff) widget (show other bugs)
Version: 5.27.10
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-26 01:53 UTC by unblended_icing552
Modified: 2024-02-22 21:33 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description unblended_icing552 2023-12-26 01:53:47 UTC
SUMMARY
Sometimes KDE became bugged and one of the launch method (Application Launcher, Krunner and Overview) produces different launch behavior than the others, usually resulting in the newly started Flatpak application to crash.

This bug is completely random, but it usually occurs after the desktop environment is up for at least a day. Logging out and re-logging in fixes the issue temporarily, until KDE becomes bugged and starts happening again.

Nothing useful splits out in `journalctl` when it happens, it seems almost the same when launching normally.

The issue have been seen on these Flatpak applications:

- Kodi https://flathub.org/apps/tv.kodi.Kodi - immediately crashes and core dumps when launched by Overview
- TLP UI https://flathub.org/apps/com.github.d4nj1.tlpui - won't open when launched by Application Launcher
- XnView MP https://flathub.org/apps/com.xnview.XnViewMP - opens, but crashes after a few seconds of usage when launched by Application Launcher

Krunner seems to always work (There might be other applications that breaks when launched by Krunner though).

STEPS TO REPRODUCE
1. Open one of the applications listed above
2. Watch it crashes (or doesn't launch at all)

OBSERVED RESULT
It crashes or doesn't launch.

EXPECTED RESULT
It should launch.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.111.0
Qt Version: 5.15.11
Wayland session
Fedora 39
This also occurs on openSUSE Tumbleweed before. It doesn't occur on Kubuntu 22.04 LTS (with KDE Plasma 5.24)

ADDITIONAL INFORMATION
The application launching logic should be moved into a standalone desktop file launcher daemon and communicated over DBus ("start this desktop file") to completely eliminate this type of inconsistencies. It isn't a good idea to construct your own launch arguments repeatedly in different components when the logic could be shared and moved into one standalone component.
Comment 1 unblended_icing552 2024-01-09 11:54:23 UTC
When KDE Plasma is bugged, by modifying the `Exec=` in desktop file, this is the result:

- `systemd-run --user` works ✅
- `kstart` doesn't work ❌
- `kioclient exec` doesn't work ❌

Additionally, by enabling "Run in Terminal", the application also launches without problem.

Enabling / disabling systemd startup doesn't make a difference (in making Flatpak applications launch): https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/

When systemd startup is disabled, by stopping plasmashell using `systemctl` and then starting it using KRunner, Application Launcher can then launch applications normally.

The point still stands: Moving the launch logic into a centralized component reduces the runtime variations and thus less debugging effort requirements and less bugs. Specifically `systemd-run` works even when the other methods doesn't because of this.
Comment 2 Nate Graham 2024-02-15 22:31:07 UTC
Launching logic is already centralized into the KIO::ApplicationLauncher job. The difference here is that Application Launcher calls that job in such a manner that it doesn't use DBus activation, while the other methods of launching apps (KRunner Task manager, etc) do. The last time I asked around, no one was able to recall whether this was intentional or not. Maybe it's time to change it.
Comment 3 Bug Janitor Service 2024-02-22 21:19:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3965
Comment 4 Nate Graham 2024-02-22 21:33:45 UTC
Git commit c5d6386c8f8f67ca9be189f51fe3da305220f96d by Nate Graham.
Committed on 22/02/2024 at 21:33.
Pushed by ngraham into branch 'master'.

applets/kicker: Always use DBus activation for launching apps

Setting the KIO::ApplicationLauncherJob::DeleteTemporaryFiles flag has
the effect of not using DBus activation for launching apps. This causes
subtly different launch and activation behaviors for when launching
apps from Kicker/Kickoff etc. compared to doing so using Task Manager,
KRunner, or all of the other app launching entry-points which do use
DBus activation. The result is unusual bugs, and inconsistent,
random-feeling behavior when things go wrong.

Let's always use the commmon DBus activation codepath here. If it's
broken or has bugs, we need to know about them and fix them, not provide
a hidden and unexpected workaround.
FIXED-IN: 6.1

M  +0    -1    applets/kicker/plugin/appentry.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/c5d6386c8f8f67ca9be189f51fe3da305220f96d