Bug 412707 - KDevelop leaves hundreds of megabytes of temp files if it crashes
Summary: KDevelop leaves hundreds of megabytes of temp files if it crashes
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-07 17:52 UTC by Tim E. Real
Modified: 2023-10-02 18:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.13.231200


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim E. Real 2019-10-07 17:52:07 UTC
SUMMARY
If KDevelop or the system crashes, hundreds of megabytes
 of temporary files are left behind in /temp, especially
 preamble-*.pch files.
This can cause failure to boot the system due to low disk space,
 requiring manual cleaning of /tmp, sometimes from
 another distro, before even being able to boot.

STEPS TO REPRODUCE
1. Use KDevelop
2. Experience a crash in KDevelop or general system.
3. Attempt to restart

OBSERVED RESULT
Cannot restart system because there is no disk space left.

EXPECTED RESULT
No junk in /tmp.

SOFTWARE/OS VERSIONS
OpenSUSE Tumbleweed

ADDITIONAL INFORMATION
Please make KDevelop check for stale temp files
 on startup and delete them before continuing.
Because it is often when starting KDevelop again
 that the disk becomes full and then total chaos occurs.

Note: Somewhat similar report is found in bug ID 378909

Thank you.
Comment 1 Igor Kushnir 2021-11-02 17:33:28 UTC
The same issue and a fix idea are described in two messages of this thread: https://mail.kde.org/pipermail/kdevelop-devel/2018-November/062135.html
Comment 2 Bug Janitor Service 2021-11-02 17:34:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/283
Comment 3 Bug Janitor Service 2021-11-02 17:34:41 UTC
A possibly relevant merge request was started @ https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/283
Comment 4 Tim E. Real 2021-11-02 22:42:44 UTC
Thanks for looking into this.
Lately it seems to be behaving much better.
Now at least, if a crash occurs, it seems that upon reboot the temp files are gone.
I find that I am having to do much less manual cleanup than before.
Thanks.
Comment 5 Igor Kushnir 2021-11-03 05:59:15 UTC
> Now at least, if a crash occurs, it seems that upon reboot the temp files are gone.
By "reboot" do you mean system restart? I think /tmp is, and has been for years/decades, cleared when a GNU/Linux system starts.
Comment 6 Tim E. Real 2021-11-04 16:24:41 UTC
Hm, you are right. I put a file in there and it was gone on reboot.
It surely was not working at the time of this bug report.
In fact at the time, Konsole was also leaving a lot of trash that was not
 cleared even on reboot, (the file dates and times proved this) 
 so I filed a report with them as well, and they fixed leaving any trash at all.

So that is why I was having so much trouble with KDevelop. On reboot
 tmp was not clearing KDevelop files, causing big trouble.
I'm on SUSE Tumbleweed, so things just gradually fixed themselves.
I wonder why it was not working before. I remember researching
 at the time whether tmp should be automatically cleared at all.

Thanks for your help.
A fan of KDevelop since the KDE2 days.
Comment 7 Tim E. Real 2021-11-04 16:32:23 UTC
I suppose this report could be closed now, as the particular reported problem
 has gone away, with respect to the leftover reboot tmp files.

Thank you.
Comment 8 Igor Kushnir 2021-11-04 16:43:56 UTC
No, I don't think it should be closed. I usually put my computer to sleep at night, reboot only once in a few weeks. So clearing the temporary files only on system reboot is not enough. My merge request clears these huge files on KDevelop start, so that they at least don't accumulate. Usually a user restarts KDevelop after it crashes to continue working, so clearing on start should be almost perfect.
Comment 9 Tim E. Real 2021-11-04 23:19:05 UTC
Ah yes. Good idea I suppose, since we do still have to manually clear the temp files out
 after a non-lockup crash to the desktop.
The trouble for me was when KDevelop occasionally crashed by locking up the computer,
 then I had all those temp files left over upon reboot. (I work on huge projects, maybe I need more RAM).
But this 'leftover temp files upon reboot' problem seems to have gone away for me. 
Thanks.
Comment 10 Igor Kushnir 2023-10-02 18:04:28 UTC
Git commit a37c72dfd724a1bd2a587b46cc8a2ecf521d5001 by Igor Kushnir.
Committed on 02/10/2023 at 19:50.
Pushed by igorkushnir into branch 'master'.

Clean up libclang's temporary files on KDevelop start

I plan to place other temporary files created by KDevelop into the
session temporary directory in the future. For example, KDevelop leaves
behind many temporary kdevelop.* files after exit. Not all KDevelop
tests remove their temporary files on exit. The session temporary
directory use can be wrapped into convenient classes derived from
QTemporaryDir and QTemporaryFile.
Related: bug 378909
FIXED-IN: 5.13.231200

M  +3    -0    kdevplatform/interfaces/icore.h
M  +75   -0    kdevplatform/shell/core.cpp
M  +1    -0    kdevplatform/shell/core.h
M  +2    -0    kdevplatform/shell/core_p.h
M  +47   -7    plugins/clang/duchain/clangindex.cpp

https://invent.kde.org/kdevelop/kdevelop/-/commit/a37c72dfd724a1bd2a587b46cc8a2ecf521d5001