Lmms: Remove QT Temp Files

Created on 16 Jun 2016  路  13Comments  路  Source: LMMS/lmms

LMMS creates several temp qt_temp.xxxx files which don't get cleaned up.

For Windows these are created in %APPDATA%\..\Local\Temp. They are created on other OSs as well in their respective temp directories.

According to https://github.com/lxde/qterminal/issues/11, this is most likely caused by QTemporaryFile which is used by ZynAddSubFX and VSTPlugin.

Originally reported here:
http://lmms.io/forum/viewtopic.php?f=15&t=5267

_(edited by @tresf, fix description, fix link, add research)_


Original bug report

The user mrlmmsguy has noticed that after using LMMS for a bit, the temporary cache file (C:\Users[my name]\AppData\Local\Temp) begins to fill with little Qt files with names like qt_temp.ut1232.
Is this related to upgrade to Qt5. I _believe_ it was just about jan t.y that Qt5 was introduced(?)
OPP:
http://lmms.io/forum/posting.php?mode=reply&f=15&t=5267

bug

All 13 comments

@musikBear fix your link. Our forum is public, the link should work in incognito mode. Did it for you, added research.

This may have something to do with ZasFX having a huge CPU footprint with multiple instruments running...

Well, the Zyn code @musikBear pointed out is ours; a wrapper we use to launch the remote process; quite different than the plugin code (the plugin doesn't use Qt at all).

It's more likely related to standard resource cleanup. We create the temp files but never remove them. Probably a relatively small fix, once identified.

We explicitly tell qt to not remove the tempfile created in ZynAddSubFxInstrument::loadSettings()

This could be related to reloadPlugin() being run when you launch the zasfx gui, press the gui button and you will get a new temp file. Wouldn't you need to explicitly remember the address to a temp file for it to be of any use later on? I see no reason for not automatically removing this file also.

The only way I can create temp files that sticks ( Qt 4.8 ) is by force quitting LMMS from the terminal while I have the zasfx gui question box open ( I can't actually test opening the gui because of the xorg-server bug )

How about just not trusting neither Qt nor the random OS temp file handling but using our own temp dir on some local directory we can clear on project launch like with recovery file? Like ~/.cache ?

http://doc.qt.io/qt-5/qtemporarydir.html#QTemporaryDir
_Edit: qtemporarydir seem to be a Qt5 thing..._

Wouldn't you need to explicitly remember the address to a temp file for it to be of any use later on? I see no reason for not automatically removing this file also.

I agree. Can't figure out how and why the file could be reused.

Edit: qtemporarydir seem to be a Qt5 thing...

We're switching to QT5 for 1.2 anyways, so this should really not be an issue

We're switching to QT5 for 1.2 anyways, so this should really not be an issue

The releases will, but the codebase is still able to be compiled against Qt4. We haven't discussed pulling Qt4 support entirely from the codebase yet. Probably a worthy discussion, but probably a bad idea for the 1.2 release.

When I open a VST I get a temp file and after I delete VST track the temp file is deleted too.
If I close a project with VSTs in it the temp files are deleted. If LMMS crash or is terminated from the command line the temp files stays. After restarting the computer they are gone. This is under Linux though. It looks like Windows doesn't clear out temp files automatically on restarting.
In any case, I don't think we need to do anything else here than fixing #2633 _'Crash when closing, every time'_ and that would prevent the temp files from cropping up in the first place.

To sum up the above. I believe that:

  • The temp files remaining is our/lmms fault, resulted by crashes. #2633, #2774
  • The temp files not being removed from /tmp after a restart of the computer is _probably more_ the OS/users responsibility.

I think this issue can be taken off the milestone for now and if the issue clears up with crashes on exit being fixed, marked as a duplicate of #2633.

PS. My temp files don't begin with qt_temp but show up like this:

{b9e3a7ba-e2a1-45cc-af8e-73f0a16eccae}
{ce9cb762-a29a-4edb-8027-5c57e76f1388}

if the issue clears up with crashes on exit being fixed, marked as a duplicate of #2633.

All evidence points to that. Done. We can reopen if evidence proves otherwise. Thanks for the attention to detail @zonkmachine.

Quoting the Qt documentation for QTemporaryFile::setAutoRemove:

On some systems, if fileName() is not called before closing the file, the temporary file may be removed regardless of the state of this property.

I think it's the reason I can reproduce this on Windows 10 but not on Ubuntu 18.04.

PS. My temp files don't begin with qt_temp but show up like this:

They look like local sockets for inter-process communication.

So I think this one was wrongly closed. Reopening.

Was this page helpful?
0 / 5 - 0 ratings