Bug 442726 - KFilePlacesModel destructor takes a long time with unplugged LABEL/UUID device in fstab causing applications to hang
Summary: KFilePlacesModel destructor takes a long time with unplugged LABEL/UUID devic...
Status: RESOLVED DUPLICATE of bug 442106
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.86.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-20 09:16 UTC by Marco Rebhan
Modified: 2021-10-15 11:19 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
/etc/fstab (1.49 KB, text/plain)
2021-09-20 09:16 UTC, Marco Rebhan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Rebhan 2021-09-20 09:16:14 UTC
Created attachment 141717 [details]
/etc/fstab

SUMMARY
I noticed Kate hanging for about 4 seconds after quitting the application, during which the window stayed open and disk activity was happening, so I decided to investigate. Most of the time was spent calling blkid_evaluate_spec("LABEL=Backup", nullptr) in KMountPoint::possibleMountPoints(). LABEL=Backup is an entry in my fstab (attached) belonging to a device which isn't plugged in, and according to the libblkid documentation [1],

> Currently, the libblkid library supports "udev" and "scan" methods. The
> "udev" method uses udev /dev/disk/by-* symlinks and the "scan" method scans
> all block devices from the /proc/partitions file. The evaluation could
> be controlled by the /etc/blkid.conf config file. The default is to try
> "udev" and then "scan" method.

And indeed, after setting EVALUATE=udev in /etc/blkid.conf to disable the "scan" method, or removing the LABEL=Backup entry from fstab, Kate no longer hangs.

This affects any application, not only Kate, that uses at the very least a file dialog (e.g. Ark and KMail have the same issue when closing their Open File dialogs, Dolphin does as well but it closes its main window before the destructor for its KFilePlacesModel runs so it's not noticeable). Since blkid_evaluate_spec only gets called from the kio code when there's an entry beginning with "LABEL" or "UUID" in the fstab and the slow blkid "scan" method usually only activates when there's no device with that label/uuid connected, this bug only triggers with a fstab entry using LABEL= or UUID= for an unconnected device.

Here's the stack trace:

#0 KMountPoint::possibleMountPoints() at /usr/src/debug/kde-frameworks/kio-5.86.0/kio-5.86.0/src/core/kmountpoint.cpp:214
#1 KCoreDirListerCache::forgetDirs() at /usr/src/debug/kde-frameworks/kio-5.86.0/kio-5.86.0/src/core/kcoredirlister.cpp:553
#2 KCoreDirListerCache::forgetDirs() at /usr/src/debug/kde-frameworks/kio-5.86.0/kio-5.86.0/src/core/kcoredirlister.cpp:479
#3 KCoreDirLister::~KCoreDirLister() at /usr/src/debug/kde-frameworks/kio-5.86.0/kio-5.86.0/src/core/kcoredirlister.cpp:2,111
#4 KCoreDirLister::~KCoreDirLister() at /usr/src/debug/kde-frameworks/kio-5.86.0/kio-5.86.0/src/core/kcoredirlister.cpp:2,113
#5 QObjectPrivate::deleteChildren() at /usr/src/debug/dev-qt/qtcore-5.15.2-r10/qtbase-c2ea67ecefe049f6e9bb8f910d7f9c60319d8619/src/corelib/kernel/qobject.cpp:2,104
#6 QObject::~QObject() at /usr/src/debug/dev-qt/qtcore-5.15.2-r10/qtbase-c2ea67ecefe049f6e9bb8f910d7f9c60319d8619/src/corelib/kernel/qobject.cpp:1,082
#7 KFilePlacesModel::~KFilePlacesModel() at /usr/src/debug/kde-frameworks/kio-5.86.0/kio-5.86.0/src/filewidgets/kfileplacesmodel.cpp:519
#8 KFilePlacesModel::~KFilePlacesModel() at /usr/src/debug/kde-frameworks/kio-5.86.0/kio-5.86.0/src/filewidgets/kfileplacesmodel.cpp:519
#9 QObjectPrivate::deleteChildren() at /usr/src/debug/dev-qt/qtcore-5.15.2-r10/qtbase-c2ea67ecefe049f6e9bb8f910d7f9c60319d8619/src/corelib/kernel/qobject.cpp:2,104
#10 QWidget::~QWidget() at /usr/src/debug/dev-qt/qtwidgets-5.15.2-r10/qtbase-c2ea67ecefe049f6e9bb8f910d7f9c60319d8619/src/widgets/kernel/qwidget.cpp:1,522
#11 ??() at /usr/lib64/qt5/plugins/ktexteditor/katefilebrowserplugin.so
#12 QObjectPrivate::deleteChildren() at /usr/src/debug/dev-qt/qtcore-5.15.2-r10/qtbase-c2ea67ecefe049f6e9bb8f910d7f9c60319d8619/src/corelib/kernel/qobject.cpp:2,104
#13 QWidget::~QWidget() at /usr/src/debug/dev-qt/qtwidgets-5.15.2-r10/qtbase-c2ea67ecefe049f6e9bb8f910d7f9c60319d8619/src/widgets/kernel/qwidget.cpp:1,522
#14 KateMDI::ToolView::~ToolView() at /home/saiko/src/kde/kate/kate/katemdi.cpp:234
#15 KateMDI::ToolView::~ToolView() at /home/saiko/src/kde/kate/kate/katemdi.cpp:234
#16 ??() at /usr/lib64/qt5/plugins/ktexteditor/katefilebrowserplugin.so
#17 KatePluginManager::disablePluginGUI() at /home/saiko/src/kde/kate/kate/katepluginmanager.cpp:292
#18 KatePluginManager::disableAllPluginsGUI() at /home/saiko/src/kde/kate/kate/katepluginmanager.cpp:180
#19 KateMainWindow::~KateMainWindow() at /home/saiko/src/kde/kate/kate/katemainwindow.cpp:194
#20 KateMainWindow::~KateMainWindow() at /home/saiko/src/kde/kate/kate/katemainwindow.cpp:203

[1]: http://ftp.ntu.edu.tw/linux/utils/util-linux/v2.26/libblkid-docs/libblkid-Tags-and-Spec-evaluation.html

STEPS TO REPRODUCE
1. Have an UUID= or LABEL= entry in /etc/fstab not belonging to a connected device (add more if necessary to increase the effect)
2. Open Kate, then close it (e.g. over File -> Quit)

OBSERVED RESULT
Kate hangs for a couple seconds and then closes.

EXPECTED RESULT
Kate closes immediately.

SOFTWARE/OS VERSIONS
Operating System: Gentoo Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Kernel Version: 5.14.6-gentoo-dist (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Comment 1 Sebastian 2021-10-15 11:19:27 UTC

*** This bug has been marked as a duplicate of bug 442106 ***