Summary: | Crash on startup | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | David Edmundson <kde> |
Component: | sessions | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | cullmann, loh.tar, oded |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/utilities/kate/commit/6daa2d968e388dbe075c149c53e2ab066de4f50d | Version Fixed In: |
Description
David Edmundson
2022-09-14 15:32:34 UTC
Crash happens every time starting kate, moving ~/.local/share/kate/ "fixes" the issues. I kept the folder, I can upload any specific files from it if needed Hi, does that happen only with master or already with 22.08? I see the same issue with current Neon unstable builds ( 4:22.08.1+p22.04+tunstable+git20220921.0105-0 ) - i.e. same stack trace. Running from the terminal, I can see a lot of KIO debug messages and then: ----8<---- kf.kio.core.dirlister: +KCoreDirLister kf.kio.core.dirlister: +KCoreDirLister kf.kio.core.dirlister: ~KCoreDirLister KCoreDirLister(0x55d4d7f53b70) kf.kio.core.dirlister: lister: KCoreDirLister(0x55d4d7f53b70) silent= false kf.kio.core.dirlister: KCoreDirLister(0x55d4d7f53b70) kf.kio.core.dirlister: Iterating over dirs () kf.xmlgui: Registering action "renamefile" under new name "rename" kf.kio.core.dirlister: KDirLister(0x55d4d7f53310) url= QUrl("file:///home/odeda") keep= false reload= false kf.kio.core.dirlister: lister: KDirLister(0x55d4d7f53310) silent= true kf.kio.core.dirlister: KDirLister(0x55d4d7f53310) kf.kio.core.dirlister: Iterating over dirs () kf.kio.core.dirlister: Listing directory: QUrl("file:///home/odeda") kf.kio.core.dirlister: Entry now being listed by (KDirLister(0x55d4d7f53310)) terminate called after throwing an instance of 'std::out_of_range' what(): map::at 18 -- exe=/usr/bin/kate 13 -- platform=xcb 11 -- display=:0 13 -- appname=kate 17 -- apppath=/usr/bin 9 -- signal=6 12 -- pid=1243687 20 -- appversion=22.11.70 17 -- programname=Kate 31 -- bugaddress=submit@bugs.kde.org 12 -- startupid=0 KCrash: crashing... crashRecursionCounter = 2 KCrash: Application Name = kate path = /usr/bin pid = 1243687 KCrash: Arguments: /usr/bin/kate .profile Aborted (core dumped) ----8<---- I can reproduce the crash by going to ~/.local/share/kate/anonymous.katesession , into the [Plugin:katefilebrowserplugin:MainWindow:0] section and setting the "location" field to a non-existing directory. This often happens in the course of a normal work day for me, where I edit a file somewhere with kate and later the directory containing that file gets deleted. Usually this is due to the fact that I use Kate as my commit message editor, so it is often called to edit temporary files in temporary directories. The problem appears to me to have been introduced in this commit: https://invent.kde.org/utilities/kate/-/commit/1b93ede0e09fcc5ef069cf5c3be33e914c660162#1d89091b7718b0df550ed065e31436f1fab5217c_1112_1123 where the new code for KateMDI::Sidebar::saveSession assumes (without checking) that all items in the tab bar are already initialized tool views, but the problem is that the KateFileBrowser tool view - when it can't immediately identify the location from its configuration as a valid folder - starts a KIO stat job, which takes time to complete - and calls into the QEventLoop. The event loop may cause the SMC save_yourself API to be called to save the current session state - calling on KateMDI::Sidebar::saveSession to save the state of a partially initialized sidebar. I believe more error checking all around would be useful, but maybe the correct fix here would be for KateFileBrowser to not set the KUrlNavigator to the configured location until a later time, as that operation has a lot of side effects that should not delay the plugin loading. Hi, Eric pointed me to this report. (In reply to Oded Arbel from comment #5) > The problem appears to me to have been introduced in this commit: > https://invent.kde.org/utilities/kate/-/commit/ > 1b93ede0e09fcc5ef069cf5c3be33e914c660162#1d89091b7718b0df550ed065e31436f1fab5 > 217c_1112_1123 > where the new code for KateMDI::Sidebar::saveSession assumes (without > checking) that all items in the tab bar are already initialized tool views, > but the problem is that the KateFileBrowser tool view - when it can't > immediately identify the location from its configuration as a valid folder - > starts a KIO stat job, which takes time to complete - and calls into the > QEventLoop. The event loop may cause the SMC save_yourself API to be called > to save the current session state - calling on KateMDI::Sidebar::saveSession > to save the state of a partially initialized sidebar. You seems to have located the issue very well, thank you. Will try to reproduce the issue and fix it... > I believe more error checking all around would be useful ...probably this way. A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/895 Git commit e703cbae9389e22bbbede1493bcede80b881e471 by Christoph Cullmann, on behalf of loh tar. Committed on 23/09/2022 at 18:53. Pushed by cullmann into branch 'master'. Sidebar: Don't save a session while session restore is running M +5 -0 apps/lib/katemdi.cpp M +1 -0 apps/lib/katemdi.h https://invent.kde.org/utilities/kate/commit/e703cbae9389e22bbbede1493bcede80b881e471 With neon unstable build 4:22.08.1+p22.04+tunstable+git20220925.0108-0, that was built from commit 90658f33f0ad58c8d61fbbcc3f37dec5468d5fa9 (which is after the fix referenced in comment 8), I still get this crash. The crash stack trace looks similar, except with updated line numbers (for the new code in the fix): ----8<---- Thread 1 (Thread 0x7f0879dd29c0 (LWP 1810286)): [KCrash Handler] #6 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44 #7 __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78 #8 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89 #9 0x00007f087e863c86 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #10 0x00007f087e84a7fc in __GI_abort () at ./stdlib/abort.c:79 #11 0x00007f087ead1b9e in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #12 0x00007f087eadd34c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #13 0x00007f087eadd3b7 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6 #14 0x00007f087eadd618 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6 #15 0x00007f087ead44c6 in std::__throw_out_of_range(char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6 #16 0x00007f088039e99c in std::map<int, KateMDI::ToolView*, std::less<int>, std::allocator<std::pair<int const, KateMDI::ToolView*> > >::at (__k=<synthetic pointer>: <optimized out>, this=0x55db32b31d68) at /usr/include/c++/11/bits/stl_map.h:541 #17 KateMDI::Sidebar::saveSession (config=..., this=<optimized out>) at ./apps/lib/katemdi.cpp:1237 #18 KateMDI::Sidebar::saveSession (config=..., this=<optimized out>) at ./apps/lib/katemdi.cpp:1214 #19 KateMDI::MainWindow::saveSession (config=..., this=0x55db339c4bd0) at ./apps/lib/katemdi.cpp:1566 #20 KateMainWindow::saveProperties (this=0x55db339c4bd0, config=...) at ./apps/lib/katemainwindow.cpp:1110 #21 0x00007f087dec5a40 in KMainWindow::savePropertiesInternal (this=0x55db339c4bd0, config=config@entry=0x55db33f4a130, number=1) at ./src/kmainwindow.cpp:621 #22 0x00007f087dec5b62 in KMWSessionManager::saveState (this=<optimized out>, sm=...) at ./src/kmainwindow.cpp:142 #23 0x00007f087ef4c6ff in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #24 0x00007f087f49e489 in QGuiApplication::saveStateRequest(QSessionManager&) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5 #25 0x00007f087f4a0a4f in QGuiApplicationPrivate::saveState() () from /lib/x86_64-linux-gnu/libQt5Gui.so.5 #26 0x00007f087974a045 in ?? () from /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 #27 0x00007f087974a187 in ?? () from /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 #28 0x00007f0879629ac2 in _SmcProcessMessage () from /lib/x86_64-linux-gnu/libSM.so.6 #29 0x00007f0879619c16 in IceProcessMessages () from /lib/x86_64-linux-gnu/libICE.so.6 #30 0x00007f087ef4c72c in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #31 0x00007f087ef4fb83 in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #32 0x00007f087ef503b5 in QSocketNotifier::event(QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #33 0x00007f087fbb1f32 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5 #34 0x00007f087ef13e38 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #35 0x00007f087ef6e695 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #36 0x00007f087cd2c4e9 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #37 0x00007f087cd81098 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #38 0x00007f087cd29ca0 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #39 0x00007f087ef6daea in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #40 0x00007f087ef127cb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #41 0x00007f088024df9d in KJob::exec() () from /lib/x86_64-linux-gnu/libKF5CoreAddons.so.5 #42 0x00007f0878cd1e98 in KDirOperator::setUrl(QUrl const&, bool) () from /lib/x86_64-linux-gnu/libKF5KIOFileWidgets.so.5 #43 0x00007f087ef4c6ff in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #44 0x00007f0878d335e9 in KUrlNavigator::urlChanged(QUrl const&) () from /lib/x86_64-linux-gnu/libKF5KIOFileWidgets.so.5 #45 0x00007f0878d33b3a in ?? () from /lib/x86_64-linux-gnu/libKF5KIOFileWidgets.so.5 #46 0x00007f087ef4c6ff in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #47 0x00007f087e1c53b2 in KCoreUrlNavigator::setCurrentLocationUrl (this=0x55db33ef47b0, newUrl=...) at ./src/gui/kcoreurlnavigator.cpp:245 #48 0x00007f0878d36e25 in KUrlNavigator::setLocationUrl(QUrl const&) () from /lib/x86_64-linux-gnu/libKF5KIOFileWidgets.so.5 #49 0x00007f086324664d in KateFileBrowser::readSessionConfig (this=0x55db33e40a60, cg=...) at ./addons/filebrowser/katefilebrowser.cpp:179 #50 0x00007f08803a66d9 in KatePluginManager::enablePluginGUI (item=0x55db339b2380, win=win@entry=0x55db339c4bd0, config=config@entry=0x55db339f3b90) at ./apps/lib/katepluginmanager.cpp:248 #51 0x00007f08803a684d in KatePluginManager::enableAllPluginsGUI (this=0x7fffae9f3ad8, win=0x55db339c4bd0, config=0x55db339f3b90) at ./apps/lib/katepluginmanager.cpp:176 #52 0x00007f0880395770 in KateMainWindow::KateMainWindow (this=<optimized out>, sconfig=<optimized out>, sgroup=..., this=<optimized out>, sconfig=<optimized out>, sgroup=...) at ./apps/lib/katemainwindow.cpp:138 #53 0x00007f08803843a7 in KateApp::newMainWindow (sconfig_=<optimized out>, sgroup_=...) at ./apps/lib/kateapp.cpp:530 #54 0x00007f0880375020 in KateSessionManager::loadSession (this=this@entry=0x7fffae9f3af8, session=...) at ./apps/lib/session/katesessionmanager.cpp:184 #55 0x00007f08803770a3 in KateSessionManager::activateSession (this=this@entry=0x7fffae9f3af8, session=..., closeAndSaveLast=closeAndSaveLast@entry=false, loadNew=loadNew@entry=true) at ./apps/lib/session/katesessionmanager.cpp:145 #56 0x00007f0880377a9a in KateSessionManager::activateSession (this=0x7fffae9f3af8, name=..., closeAndSaveLast=closeAndSaveLast@entry=false, loadNew=loadNew@entry=true) at ./apps/lib/session/katesessionmanager.cpp:221 #57 0x00007f0880377b62 in KateSessionManager::activateAnonymousSession (this=<optimized out>) at ./apps/lib/session/katesessionmanager.cpp:226 #58 0x00007f088038b5bc in KateApp::startupKate (this=0x7fffae9f3a10) at ./apps/lib/kateapp.cpp:275 #59 0x000055db30d34385 in main (argc=<optimized out>, argv=<optimized out>) at ./apps/kate/main.cpp:590 ----8<---- Sorry for the bugspam, I just want to make sure that I mention that the repro for this updated crash stack is identical as I was previously doing: set `[Plugin:katefilebrowserplugin:MainWindow:0]` -> `location` to a non-existing directory and try to open a file with kate. Hm, yes. After the request to use some bool I forgot to set it properly to true at some useful place. No idea why it has worked anyway. And the extra stuff by Christoph did it at the wrong place. A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/904 Git commit 6daa2d968e388dbe075c149c53e2ab066de4f50d by loh tar. Committed on 25/09/2022 at 10:26. Pushed by cullmann into branch 'master'. Sidebar: Set session restore flag at correct place M +8 -3 apps/lib/katemdi.cpp https://invent.kde.org/utilities/kate/commit/6daa2d968e388dbe075c149c53e2ab066de4f50d |