Skip to content
Commit 73185564 authored by Milian Wolff's avatar Milian Wolff
Browse files

Actually remove temporary item repository directories

The shutdown procedure was changed in commit c3c9ea8a, but that
broke removal of temporary item repository directories. The repo
was shutdown before the session is cleared, which will try to
remove the dir. But it just marked the dir for removal, which should
then happen in shutdown, but that was called already. So detect that
and remove the dir directly then.
parent 65cdabaf
Pipeline #19387 passed with stage
in 30 minutes and 51 seconds
  • Developer

    Shouldn't this be merged into the 5.5 branch because the offending commit is in there too?

    I've reported a number of hang-on-exist cases that seem they may be prevented by this change.

    • Developer

      I'm not sure if my problem is the same, but I also often experience KDevelop hanging on exit lately (about once every two days). The KDevelop version is from the official Arch repository: 5.5.0-2. KDevelop freezes at this step:

      #0  0x00007fc917341e15 in  () at /usr/lib/libKDevPlatformLanguage.so.55
      #1  0x00007fc916e8fb8c in KDevelop::ItemRepositoryRegistry::finalCleanup() () at /usr/lib/libKDevPlatformSerialization.so.55
      #2  0x00007fc917269a4b in KDevelop::DUChain::shutdown() () at /usr/lib/libKDevPlatformLanguage.so.55
      #3  0x00007fc91a155016 in KDevelop::Core::cleanup() () at /usr/lib/libKDevPlatformShell.so.55
      #4  0x00007fc91a1552b0 in KDevelop::Core::shutdown() () at /usr/lib/libKDevPlatformShell.so.55
      #5  0x00007fc91a13425f in KDevelop::MainWindow::~MainWindow() () at /usr/lib/libKDevPlatformShell.so.55
    • Author Developer

      can you get a full backtrace with all threads? is it fixed by this patch? one way or another, the whole cleanup stuff is pretty brittle, just like the duchain overall...

    • Developer

      I don't know if the freezes are fixed by this patch. They are not easily reproducible. If the freezes keep happening after the update to 5.5.1, I'll install KDevelop master.

      Attached backtraces from all the freezes: kdevelop-finalCleanup-freezes.7z. Notes:

      1. While the backtraces on different days differ, the backtrace stays practically the same after a few seconds of maximum-using of one CPU core.
      2. The snippet I posted above is common to all these backtraces.
      3. The freezes started happening on 2020-04-22 - the day I upgraded kdevelop to 5.5.0-2. So maybe this is related to LLVM version 10.
    • Author Developer

      @igorkushnir you seem to be lacking debug symbols, but one way or another this shouldn't be related to this patch here. It's probably also not related to the LLVM version but rather a lurking deadlock in kdevelop.

    • Developer

      There was the same problem with KDevelop 5.5.1. However after I switched to master (the kdevelop-git package plus debug symbols) I haven't experienced any freezes. Either this patch or some other change must have eliminated the bug I experienced.

    • Please register or sign in to reply
  • Author Developer

    @rjvbb "seem they may" or are the really gone? I don't see how that should be related, as this code path is mostly relevant for temporary sessions only, and these are used only in tests...

  • Developer

    To be honest I haven't tried because I saw you reverted this patch with apparently good reason. And I'm not getting the hanging in tests and mostly with an "intemporal" session (= one that I restart only occasionally) :)

  • Author Developer

    this one wasn't reverted :)

  • Developer

    OK, it's included now, we'll see if I still get hangs on exit. For me too they've been unpredictable, with backtraces that were utterly useless except to suggest that a mutex (or something) somewhere must have remained locked.

    Which reminds me, aren't there timeouts in the DUChain cleanup code? If those trigger, could that lead to forgetting to unlock a mutex? That would certainly explain the unpredictable nature of the hang.

  • Developer

    @rjvbb "seem they may" or are the really gone?

    "Seem they may be", sadly.

    I just quit a session that had seen quite a few git branch changes of a largish project (MuseScore). I had started the build outside of KDevelop (as I always do), which put a considerable load on the machine I'm on now. I had also closed and reopened the MuseScore project and waited for KDevelop to go idle before telling it to quit. I'm printing trace output from the core cleanup routine so I know it had completed, but when I didn't see the app exit I suspended the build job. I've already seen KDevelop completing its shutdown after suspending other CPU, RAM and I/O intensive operations, but no such luck this time. Here's the backtrace you asked for (note the 'kdevelo:disk$0' thread; no idea where that comes from)

    (lldb) process attach --pid 21998 Process 21998 stopped

    • thread #1 (closed), name = 'kdevelop', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 thread #2, name = 'QXcbEventReader', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 thread #3 (closed), name = 'kdevelo:disk$0', stop reason = signal SIGSTOP frame #0: 0x00007fe004f72404 libpthread.so.0__pthread_cond_wait at pthread_cond_wait.S:185 thread #4, name = 'QDBusConnection', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 thread #5 (closed), name = 'QThread', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 thread #6, name = 'OutputFilterThr', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 thread #7 (closed), name = 'Qt bearer threa', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6`__GI___poll at syscall-template.S:81

    Executable module set to "/opt/local/bin/kdevelop". Architecture set to: x86_64-unknown-linux-gnu. (lldb) bt all

    • thread #1 (closed), name = 'kdevelop', stop reason = signal SIGSTOP
      • frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 frame #1: 0x00007fdffe0be761 libglib-2.0.so.0g_main_context_iterate at gmain.c:4209:13 frame #2: 0x00007fdffe0be70b libglib-2.0.so.0g_main_context_iterate(context=<unavailable>, block=<unavailable>, dispatch=<unavailable>, self=<unavailable>) at gmain.c:3903 frame #3: 0x00007fdffe0bea21 libglib-2.0.so.0g_main_context_iteration(context=0x00007fdfec003030, may_block=1) at gmain.c:3969:12 frame #4: 0x00007fe0088655db libQt5Core.so.5QEventDispatcherGlib::processEvents(this=0x00000000013e0df0, flags=<unavailable>) at qeventdispatcher_glib.cpp:425:18 frame #5: 0x00007fe008811472 libQt5Core.so.5QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) [inlined] QEventLoop::processEvents(this=, flags=) at qeventloop.cpp:134:51 frame #6: 0x00007fe008811455 libQt5Core.so.5QEventLoop::exec(this=0x00007ffc5c21bc00, flags=<unavailable>) at qeventloop.cpp:212 frame #7: 0x00007fe008815cad libQt5Core.so.5QCoreApplication::exec() at qcoreapplication.cpp:1304:32 frame #8 (closed): 0x000000000041391a kdevelopmain(argc=<unavailable>, argv=<unavailable>) at main.cpp:1008:12 frame #9: 0x00007fe0079a2f45 libc.so.6__libc_start_main(main=(kdevelopmain at main.cpp:445), argc=2, argv=0x00007ffc5c21bf88, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007ffc5c21bf78) at libc-start.c:287 frame #10: 0x00000000004068a4 kdevelop_start + 41 thread #2, name = 'QXcbEventReader', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 frame #1: 0x00007fdffcb36ab2 libxcb.so.1_xcb_conn_wait + 194 frame #2: 0x00007fdffcb38eba libxcb.so.1xcb_wait_for_event + 122 frame #3: 0x00007fdff49acf49 libQt5XcbQpa.so.5QXcbEventReader::run(this=0x00000000011e5070) at qxcbconnection.cpp:1330:37 frame #4: 0x00007fe00866a423 libQt5Core.so.5QThreadPrivate::start(arg=0x00000000011e5070) at qthread_unix.cpp:368:10 frame #5: 0x00007fe004f6e184 libpthread.so.0start_thread(arg=0x00007fdff2a58700) at pthread_create.c:312 frame #6: 0x00007fe007a7f03d libc.so.6__clone at clone.S:111 thread #3, name = 'kdevelo:disk$0', stop reason = signal SIGSTOP frame #0: 0x00007fe004f72404 libpthread.so.0__pthread_cond_wait at pthread_cond_wait.S:185 frame #1 (closed): 0x00007fdff0f83b2b i965_dri.soutil_queue_thread_func [inlined] cnd_wait at threads_posix.h:155:13 frame #2: 0x00007fdff0f83b14 i965_dri.soutil_queue_thread_func(input=) at u_queue.c:270 frame #3 (closed): 0x00007fdff0f84446 i965_dri.soimpl_thrd_routine(p=<unavailable>) at threads_posix.h:87:29 frame #4: 0x00007fe004f6e184 libpthread.so.0start_thread(arg=0x00007fdfebdf4700) at pthread_create.c:312 frame #5 (closed): 0x00007fe007a7f03d libc.so.6__clone at clone.S:111 thread #4, name = 'QDBusConnection', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 frame #1 (closed): 0x00007fdffe0be761 libglib-2.0.so.0g_main_context_iterate at gmain.c:4209:13 frame #2: 0x00007fdffe0be70b libglib-2.0.so.0g_main_context_iterate(context=, block=, dispatch=, self=) at gmain.c:3903 frame #3 (closed): 0x00007fdffe0bea21 libglib-2.0.so.0g_main_context_iteration(context=0x00007fdfdc000990, may_block=1) at gmain.c:3969:12 frame #4: 0x00007fe0088655db libQt5Core.so.5QEventDispatcherGlib::processEvents(this=0x00007fdfdc0008c0, flags=) at qeventdispatcher_glib.cpp:425:18 frame #5 (closed): 0x00007fe008811472 libQt5Core.so.5QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QEventLoop::processEvents(this=<unavailable>, flags=<unavailable>) at qeventloop.cpp:134:51 frame #6: 0x00007fe008811455 libQt5Core.so.5QEventLoop::exec(this=0x00007fdfe4666948, flags=) at qeventloop.cpp:212 frame #7 (closed): 0x00007fe008666867 libQt5Core.so.5QThread::exec(this=<unavailable>) at qthread.cpp:515:32 frame #8: 0x00007fe009de4630 libQt5DBus.so.5QDBusConnectionManager::run(this=0x00007fe00a0442e0) at qdbusconnection.cpp:178:5 frame #9 (closed): 0x00007fe00866a423 libQt5Core.so.5QThreadPrivate::start(arg=0x00007fe00a0442e0) at qthread_unix.cpp:368:10 frame #10: 0x00007fe004f6e184 libpthread.so.0start_thread(arg=0x00007fdfe4667700) at pthread_create.c:312 frame #11 (closed): 0x00007fe007a7f03d libc.so.6__clone at clone.S:111 thread #5, name = 'QThread', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 frame #1 (closed): 0x00007fdffe0be761 libglib-2.0.so.0g_main_context_iterate at gmain.c:4209:13 frame #2: 0x00007fdffe0be70b libglib-2.0.so.0g_main_context_iterate(context=, block=, dispatch=, self=) at gmain.c:3903 frame #3 (closed): 0x00007fdffe0bea21 libglib-2.0.so.0g_main_context_iteration(context=0x00007fdfd4000990, may_block=1) at gmain.c:3969:12 frame #4: 0x00007fe0088655db libQt5Core.so.5QEventDispatcherGlib::processEvents(this=0x00007fdfd40008c0, flags=) at qeventdispatcher_glib.cpp:425:18 frame #5 (closed): 0x00007fe008811472 libQt5Core.so.5QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QEventLoop::processEvents(this=<unavailable>, flags=<unavailable>) at qeventloop.cpp:134:51 frame #6: 0x00007fe008811455 libQt5Core.so.5QEventLoop::exec(this=0x00007fdfe11fc8f8, flags=) at qeventloop.cpp:212 frame #7 (closed): 0x00007fe008666867 libQt5Core.so.5QThread::exec(this=<unavailable>) at qthread.cpp:515:32 frame #8: 0x00007fe00f7cc20e libKDevPlatformLanguage.so.55KDevelop::DUChainPrivate::CleanupThread::run(this=0x0000000002377f10) at duchain.cpp:331:13 frame #9 (closed): 0x00007fe00866a423 libQt5Core.so.5QThreadPrivate::start(arg=0x0000000002377f10) at qthread_unix.cpp:368:10 frame #10: 0x00007fe004f6e184 libpthread.so.0start_thread(arg=0x00007fdfe11fd700) at pthread_create.c:312 frame #11 (closed): 0x00007fe007a7f03d libc.so.6__clone at clone.S:111 thread #6, name = 'OutputFilterThr', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 frame #1 (closed): 0x00007fdffe0be761 libglib-2.0.so.0g_main_context_iterate at gmain.c:4209:13 frame #2: 0x00007fdffe0be70b libglib-2.0.so.0g_main_context_iterate(context=, block=, dispatch=, self=) at gmain.c:3903 frame #3 (closed): 0x00007fdffe0bea21 libglib-2.0.so.0g_main_context_iteration(context=0x00007fdfd0000990, may_block=1) at gmain.c:3969:12 frame #4: 0x00007fe0088655db libQt5Core.so.5QEventDispatcherGlib::processEvents(this=0x00007fdfd00008c0, flags=) at qeventdispatcher_glib.cpp:425:18 frame #5 (closed): 0x00007fe008811472 libQt5Core.so.5QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QEventLoop::processEvents(this=<unavailable>, flags=<unavailable>) at qeventloop.cpp:134:51 frame #6: 0x00007fe008811455 libQt5Core.so.5QEventLoop::exec(this=0x00007fdfd9f11978, flags=) at qeventloop.cpp:212 frame #7 (closed): 0x00007fe008666867 libQt5Core.so.5QThread::exec(this=<unavailable>) at qthread.cpp:515:32 frame #8: 0x00007fe00866a423 libQt5Core.so.5QThreadPrivate::start(arg=0x00007fe00f2c57c8) at qthread_unix.cpp:368:10 frame #9 (closed): 0x00007fe004f6e184 libpthread.so.0start_thread(arg=0x00007fdfd9f12700) at pthread_create.c:312 frame #10: 0x00007fe007a7f03d libc.so.6__clone at clone.S:111 thread #7 (closed), name = 'Qt bearer threa', stop reason = signal SIGSTOP frame #0: 0x00007fe007a71c9d libc.so.6__GI___poll at syscall-template.S:81 frame #1: 0x00007fdffe0be761 libglib-2.0.so.0g_main_context_iterate at gmain.c:4209:13 frame #2: 0x00007fdffe0be70b libglib-2.0.so.0g_main_context_iterate(context=<unavailable>, block=<unavailable>, dispatch=<unavailable>, self=<unavailable>) at gmain.c:3903 frame #3: 0x00007fdffe0bea21 libglib-2.0.so.0g_main_context_iteration(context=0x00007fdfc8000990, may_block=1) at gmain.c:3969:12 frame #4: 0x00007fe0088655db libQt5Core.so.5QEventDispatcherGlib::processEvents(this=0x00007fdfc80008c0, flags=<unavailable>) at qeventdispatcher_glib.cpp:425:18 frame #5: 0x00007fe008811472 libQt5Core.so.5QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) [inlined] QEventLoop::processEvents(this=, flags=) at qeventloop.cpp:134:51 frame #6: 0x00007fe008811455 libQt5Core.so.5QEventLoop::exec(this=0x00007fdfcfffe978, flags=<unavailable>) at qeventloop.cpp:212 frame #7: 0x00007fe008666867 libQt5Core.so.5QThread::exec(this=) at qthread.cpp:515:32 frame #8 (closed): 0x00007fe00866a423 libQt5Core.so.5QThreadPrivate::start(arg=0x00000000023f79f0) at qthread_unix.cpp:368:10 frame #9: 0x00007fe004f6e184 libpthread.so.0start_thread(arg=0x00007fdfcffff700) at pthread_create.c:312 frame #10 (closed): 0x00007fe007a7f03d libc.so.6`__clone at clone.S:111
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment