Bug 467888 - Just opening Discover seems to crash it in PackageKitBackend::resolvePackages() (5.27.3 this time)
Summary: Just opening Discover seems to crash it in PackageKitBackend::resolvePackages...
Status: RESOLVED FIXED
Alias: None
Product: Discover
Classification: Applications
Component: PackageKit (show other bugs)
Version: 5.27.3
Platform: Neon Linux
: VHI crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: drkonqi
: 466702 467068 469422 472898 473584 474046 474764 475429 475526 476835 482259 494186 495007 495478 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-03-28 16:15 UTC by the_archer_xz
Modified: 2024-11-08 21:25 UTC (History)
16 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description the_archer_xz 2023-03-28 16:15:11 UTC
Application: plasma-discover (5.27.3)

Qt Version: 5.15.8
Frameworks Version: 5.104.0
Operating System: Linux 5.19.0-35-generic x86_64
Windowing System: X11
Distribution: KDE neon 5.27
DrKonqi: 5.27.3 [KCrashBackend]

-- Information about the crash:
I open it on the home section and it crashes. Seems that for some reason, to get past it, I have to click the tray icon to show updates and then click home. Really weird.

The crash can be reproduced every time.

-- Backtrace:
Application: Discover (plasma-discover), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f22defc511c in  () at /usr/lib/x86_64-linux-gnu/qt5/plugins/discover/packagekit-backend.so
#5  0x00007f22defc5180 in PackageKitBackend::resolvePackages(QStringList const&) () at /usr/lib/x86_64-linux-gnu/qt5/plugins/discover/packagekit-backend.so
#6  0x00007f22defc7d4f in  () at /usr/lib/x86_64-linux-gnu/qt5/plugins/discover/packagekit-backend.so
#7  0x00007f22defcc11d in  () at /usr/lib/x86_64-linux-gnu/qt5/plugins/discover/packagekit-backend.so
#8  0x00007f2337ce9ade in QObject::event(QEvent*) (this=0x557f99058a30, e=0x7f22ac01b000) at kernel/qobject.cpp:1347
#9  0x00007f233976c793 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x557f99058a30, e=0x7f22ac01b000) at kernel/qapplication.cpp:3640
#10 0x00007f2337cbc07a in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x557f99058a30, event=0x7f22ac01b000) at kernel/qcoreapplication.cpp:1064
#11 0x00007f2337cbf167 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x557f98f43c00) at kernel/qcoreapplication.cpp:1821
#12 0x00007f2337d16487 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x557f99021ff0) at kernel/qeventdispatcher_glib.cpp:277
#13 0x00007f23365c7d3b in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007f233661c6c8 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007f23365c53e3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007f2337d15ad8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x557f99026ee0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#17 0x00007f2337cba99b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffd73f2d7d0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#18 0x00007f2337cc2f34 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#19 0x0000557f979b5c63 in  ()
#20 0x00007f2337229d90 in __libc_start_call_main (main=main@entry=0x557f979b5340, argc=argc@entry=1, argv=argv@entry=0x7ffd73f2dab8) at ../sysdeps/nptl/libc_start_call_main.h:58
#21 0x00007f2337229e40 in __libc_start_main_impl (main=0x557f979b5340, argc=1, argv=0x7ffd73f2dab8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd73f2daa8) at ../csu/libc-start.c:392
#22 0x0000557f979b66a5 in  ()
[Inferior 1 (process 5601) detached]

The reporter indicates this bug may be a duplicate of or related to bug 467188.

Reported using DrKonqi
Comment 1 the_archer_xz 2023-03-28 16:44:44 UTC
Found a temporary fix to this. Seems like when Discover starts with the default 'browse' mode, it crashes. 

So, out of this list I pulled:

Available modes:
 * Browsing
 * Installed
 * Search
 * Update
 * Sources
 * About

All those options work except browsing. Browsing mode will just crash Discover. I just edited shortcut in the menu to this:

plasma-discover --mode search

And now Discover works.
Comment 2 Nate Graham 2023-05-15 20:37:48 UTC
*** Bug 469422 has been marked as a duplicate of this bug. ***
Comment 3 Nate Graham 2023-05-15 20:38:11 UTC
*** Bug 466702 has been marked as a duplicate of this bug. ***
Comment 4 Nate Graham 2023-08-02 20:53:48 UTC
*** Bug 472898 has been marked as a duplicate of this bug. ***
Comment 5 Nate Graham 2023-08-22 21:08:29 UTC
*** Bug 473584 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2023-09-05 21:11:29 UTC
*** Bug 474046 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2023-09-05 21:11:40 UTC
*** Bug 467068 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2023-09-21 16:13:29 UTC
*** Bug 474764 has been marked as a duplicate of this bug. ***
Comment 9 Harald Sitter 2023-10-06 11:15:18 UTC
Git commit 2e52e7c9aa44ca1b3f5009fd7e6daf66fc8d31a6 by Harald Sitter.
Committed on 06/10/2023 at 13:14.
Pushed by sitter into branch 'master'.

packagekit: hold stream in a qpointer

there is a very awkward race condition involving streams during
initialization. if any of the (KNS) backends fail to initialize and
become invalid they will eventually trigger
`ResourcesModel::callerFetchingChanged` which will discard the now
invalid backends and emit `backendsChanged` which will trigger
`ResourcesProxyModel::invalidateFilter` which then may end up deleting
the current stream

```
    if (m_currentStream) {
qCWarning(LIBDISCOVER_LOG) << "last stream isn't over yet" <<
m_filters << this;
        delete m_currentStream;
```

this is in so far problematic as we "schedule" lambda executions in the
packagekit backend (most prominently in `PackageKitBackend::search`)
with lambdas that hold the stream. these lambdas will eventually run on
since-deleted stream objects and best case fall into a nullptr but more
regularly just fall into a ditch of random memory until undefined
behavior bites us
Related: bug 465711, bug 473921

M  +31   -8    libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp

https://invent.kde.org/plasma/discover/-/commit/2e52e7c9aa44ca1b3f5009fd7e6daf66fc8d31a6
Comment 10 Harald Sitter 2023-10-06 11:22:35 UTC
Git commit 107716c0b3a9e2dc4ac569ca002ee71dc59baa0d by Harald Sitter.
Committed on 06/10/2023 at 13:16.
Pushed by sitter into branch 'Plasma/5.27'.

packagekit: hold stream in a qpointer

there is a very awkward race condition involving streams during
initialization. if any of the (KNS) backends fail to initialize and
become invalid they will eventually trigger
`ResourcesModel::callerFetchingChanged` which will discard the now
invalid backends and emit `backendsChanged` which will trigger
`ResourcesProxyModel::invalidateFilter` which then may end up deleting
the current stream

```
    if (m_currentStream) {
qCWarning(LIBDISCOVER_LOG) << "last stream isn't over yet" <<
m_filters << this;
        delete m_currentStream;
```

this is in so far problematic as we "schedule" lambda executions in the
packagekit backend (most prominently in `PackageKitBackend::search`)
with lambdas that hold the stream. these lambdas will eventually run on
since-deleted stream objects and best case fall into a nullptr but more
regularly just fall into a ditch of random memory until undefined
behavior bites us
Related: bug 465711, bug 473921
(cherry picked from commit 2e52e7c9aa44ca1b3f5009fd7e6daf66fc8d31a6)

M  +31   -8    libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp

https://invent.kde.org/plasma/discover/-/commit/107716c0b3a9e2dc4ac569ca002ee71dc59baa0d
Comment 11 Nate Graham 2023-10-11 19:11:21 UTC
*** Bug 475429 has been marked as a duplicate of this bug. ***
Comment 12 Nate Graham 2023-10-12 19:58:34 UTC
*** Bug 475526 has been marked as a duplicate of this bug. ***
Comment 13 Nate Graham 2023-11-15 20:06:16 UTC
*** Bug 476835 has been marked as a duplicate of this bug. ***
Comment 14 Nate Graham 2024-03-05 17:11:10 UTC
*** Bug 482259 has been marked as a duplicate of this bug. ***
Comment 15 Filip 2024-10-06 17:01:23 UTC
*** Bug 494186 has been marked as a duplicate of this bug. ***
Comment 16 Nate Graham 2024-10-28 13:59:43 UTC
*** Bug 495478 has been marked as a duplicate of this bug. ***
Comment 17 Nate Graham 2024-11-08 21:25:10 UTC
*** Bug 495007 has been marked as a duplicate of this bug. ***