https://bugs.kde.org/show_bug.cgi?id=442726

            Bug ID: 442726
           Summary: KFilePlacesModel destructor takes a long time with
                    unplugged LABEL/UUID device in fstab causing
                    applications to hang
           Product: frameworks-kio
           Version: 5.86.0
          Platform: Gentoo Packages
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Created attachment 141717
  --> https://bugs.kde.org/attachment.cgi?id=141717&action=edit
/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

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to