Summary: | klauncher crashes because accessing dangled pointers | ||
---|---|---|---|
Product: | [Frameworks and Libraries] frameworks-kinit | Reporter: | Ralf Habacker <ralf.habacker> |
Component: | general | Assignee: | David Faure <faure> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | kdelibs-bugs |
Priority: | NOR | ||
Version: | 5.65.0 | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Microsoft Windows | ||
Latest Commit: | https://invent.kde.org/frameworks/kinit/commit/2a5d047b49a866de7e478a632ef53ab1d711c273 | Version Fixed In: | 5.85.0 |
Sentry Crash Report: | |||
Bug Depends on: | |||
Bug Blocks: | 426400, 435581 |
Description
Ralf Habacker
2020-09-10 22:11:01 UTC
Fixed in the OBS Mingw distribution with https://build.opensuse.org/package/view_file/home:rhabacker:branches:windows:mingw:win32:KF565/mingw32-kinit/0001-Fix-klauncher-crashes-because-accessing-dangled-poin.patch?expand=1 A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kinit/-/merge_requests/6 A workaround is to skip using klauncher by either 1. setting KDE_FORK_SLAVES=1 in front of starting an application or 2. configure KIO with cmake ... -DKIO_FORK_SLAVES=1 at https://build.opensuse.org/package/show/windows:mingw:win32/mingw32-kio and https://build.opensuse.org/package/show/windows:mingw:win64/mingw64-kio Since klauncher is not used at binary factory, this problem has probably not been detected yet. The advantage of using klauncher is that it is easier to terminate running slaves after a KDE session by terminating klauncher. This is necessary, for example, for portable installations that are started from a USB stick or similar. Without terminating the background processes the USB stick cannot be removed again. (In reply to Bug Janitor Service from comment #2) It was mentioned at https://invent.kde.org/frameworks/kinit/-/merge_requests/6#note_195092 that the dangling pointer seems to be just an indication of a deeper problem with the signal/slot system and requires further troubleshooting. Since there are currently no qt5 pretty printers for gdb, this will probably be delayed until the GSOC project https://community.kde.org/GSoC/2021/Ideas#Project:_Add_gdb_pretty_printer_support_for_Qt5 is completed. Git commit 2a5d047b49a866de7e478a632ef53ab1d711c273 by Ralf Habacker. Committed on 21/07/2021 at 07:42. Pushed by dfaure into branch 'master'. Fixes crash in KLauncher::idleTimeout() caused by unblockable destruction of IdleSlave objects According to the documentation of QObject::destroyed() at https://doc.qt.io/qt-5/qobject.html#destroyed this signal cannot be be blocked. This can lead to the fact that by removing an object from mSlaveList by slotSlaveGone(), the contents of the list are changed in such a way that with the next iteration again an access to the deleted object takes place and thereby a segmentation fault is released. See the following real world trace without this patch "2021/07/14 12:57:55,782" idleTimeout "2021/07/14 12:57:55,782" idleTimeout 0x4d29a60 "2021/07/14 12:57:55,782" idleTimeout 0x4d32778 "2021/07/14 12:57:55,782" idleTimeout killing KIO::IdleSlave(0x4d32778) "2021/07/14 12:57:55,782" slotSlaveGone QObject(0x4d32778) "2021/07/14 12:57:55,782" idleTimeout 0x4d54550 "2021/07/14 12:57:55,782" idleTimeout killing KIO::IdleSlave(0x4d54550) "2021/07/14 12:57:55,782" slotSlaveGone QObject(0x4d54550) "2021/07/14 12:57:55,782" idleTimeout 0x4d61460 "2021/07/14 12:57:55,782" idleTimeout killing KIO::IdleSlave(0x4d61460) "2021/07/14 12:57:55,782" slotSlaveGone QObject(0x4d61460) "2021/07/14 12:57:55,782" idleTimeout 0x4d61460 Thread 1 received signal SIGSEGV, Segmentation fault. where the calls to slotSlaveGone() are intermixed with the iteration. In the opposite after applying this patch there is "2021/07/14 13:06:12,870" idleTimeout "2021/07/14 13:06:12,870" idleTimeout 0x4d3a668 "2021/07/14 13:06:12,870" idleTimeout 0x4d6f8e8 "2021/07/14 13:06:12,870" idleTimeout killing KIO::IdleSlave(0x4d6f8e8) "2021/07/14 13:06:12,870" idleTimeout 0x4d60540 "2021/07/14 13:06:12,870" idleTimeout killing KIO::IdleSlave(0x4d60540) "2021/07/14 13:06:12,870" idleTimeout 0x4d6d400 "2021/07/14 13:06:12,870" idleTimeout killing KIO::IdleSlave(0x4d6d400) "2021/07/14 13:06:12,870" idleTimeout 0x4da14a8 "2021/07/14 13:06:12,870" idleTimeout killing KIO::IdleSlave(0x4da14a8) "2021/07/14 13:06:12,870" slotSlaveGone QObject(0x4d6f8e8) "2021/07/14 13:06:12,870" slotSlaveGone QObject(0x4d60540) "2021/07/14 13:06:12,870" slotSlaveGone QObject(0x4d6d400) "2021/07/14 13:06:12,870" slotSlaveGone QObject(0x4da14a8) which shows that deleting the slaves after leaving idleTimeout() happens. FIXED-IN:5.85.0 M +1 -1 src/klauncher/klauncher.cpp https://invent.kde.org/frameworks/kinit/commit/2a5d047b49a866de7e478a632ef53ab1d711c273 |