fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
5.01k stars 293 forks source link

Pluto does not delete its temp folders #3097

Closed donovaly closed 1 week ago

donovaly commented 1 week ago

As also reported in #3035, on every start Pluto creates a Tamp folder. In my case it is a folder like

C:\Users\AppData\Local\Temp\jl_BJkWpS

The bug is that after ending the Pluto server by pressing Ctrl+C in the REPL, this temp folder is not deleted. I have now dozeons of these folders each containing Manifest.toml and a Project.toml

fonsp commented 1 week ago

Hey @donovaly ! It sounds like you are learning about Julia and Pluto, which is great!

When these questions come up, it might be more helpful to ask them in the Julia forums (discourse, zulip, slack) rather than posting them as Issues on Pluto.

donovaly commented 6 days ago

Why do you close this? I reported a bug I could reproduce on different PCs. A program must delete its Temp folders when it is closed. Pluto does not do this.

When these questions come up,

I reported a reproducible bug, and did not ask a question You also closed my bug report as "not planned". So you it is a planned "feature" that Pluto pollutes the temp folder? I cannot follow your logic.

pankgeorg commented 5 days ago

Hello @donovaly! Thanks for the report. Pluto doesn't automatically remove the temp files because for a lot of users this acts like a backup. This is the exact reason why Microsoft also doesn't remove files from %temp% there automatically.

If you're running low on storage and want to save up the few MiBs Projects, Manifests and notebooks may introduce, you can turn the Microsoft Storage Sense technology on, by going to Settings > Storage Settings > Storage Sense and checking the first checkbox. This will tell Windows to act and cleanup temporary files in %TEMP% and other places. It's enabled in newer installations of Windows 11, and it is available since Windows 10. Note that it won't delete anything until it really needs to.

If you have a different reason you want these files removed, please explain your case in some extra detail (i.e. I don't want to leave traces on the computer). But note that the development bandwidth may be low for niche problems, so we can't promise that we will resolve this, especially if it conflicts with other people's workflows.

Hope that helps! Best, Panagiotis

donovaly commented 4 days ago

Pluto doesn't automatically remove the temp files because for a lot of users this acts like a backup. This is the exact reason why Microsoft also doesn't remove files from %temp% there automatically.

Thanks @pankgeorg , the Windows guidelines say that programs that created files in the user's temp folder should remove it. This is the common "good practice", as you can also find at various places: Windows programming guidelines: Does a Program have to delete the files it wrote to the the user's temp folder when it is closed?

For backups there should be backup folder. For example for FreeCAD we therefore create for backups a dedicated backup folder. The users can set any folder he likes as backup folder. Our default is C:/Users/<username>/AppData/Local/cache/FreeCAD/Cache/

If you have a different reason you want these files removed

To keep the system clean. All projects I am or was involved in we cleaned the Temp folder on closing the program (or on uninstalling). As stated above, it is good practice because imagine all the many programs you have installed don't delete their temp folders? I have many programs installed and Pluto is besides Visual Studio (not VS Code) the only one I see that does not remove the folders it created in the the User's Temp folder. For Visual Studio that started with the latest update, is probably a bug

pankgeorg commented 4 days ago

I'm aware of what Microsoft asks the developers to do. But let's be honest here, if Microsoft believed the developers, they would clear the %temp% folder themselves on every restart, maybe even more often. They don't. We also don't. Everyone is happy with that. Pluto is a frontend project, so this is quite low on our priority list. Feel free to submit a PR though!

donovaly commented 4 days ago

Everyone is happy with that. Pluto is a frontend project,

I came to Pluto because it is a frontend project. And I am not happy about it, otherwise I would not have filed this bug report.

My proposal: Allow users to specify a custom folder as backup folder. This would be more intuitive because then it is clear that

p.s. saying "we don't care about the common good practice" is not a good behavior. I am a developer too, do this in my spare time and most of my colleagues don't use Windows at all, but we try to follow the best practices. When someone tells us we don't do, we at least evaluate this.

pankgeorg commented 4 days ago

And I am not happy about it, otherwise I would not have filed this bug report.

Thank you for the input. Note that this software is provided as is, without warranty of any kind (see the license).

My proposal: Allow users to specify a custom folder as backup folder.

This is a good proposal. We'll happily evaluate a PR if someone finds the time to implement it. As Fons proposed above, we would expect the fix for the mkdir() method to be somewhere in julia itself, but we're open to reconsider this if a good, local solution is proposed (in the form of a PR).

Note that the mktempdir() function that we use for creating temporary files (in many places, but more importantly here) should cleanup after itself, according to the docs, given how we use it. So the problem doesn't seem to lie with Pluto.

Unfortunately, we don't have enough bandwidth to focus on this right now, and investigate what is actually happening.

common good practice

I'm not sure that I would label this a "common practice". Cleaning up the %TEMP% folder is done on a best effort basis at best (if atexit() hooks don't run it doesn't happen). This is expected to begin with, and this is why Windows have utilities to automatically clean this space up (the Storage Sense). Looking at my %TEMP% directory, I see non-cleaned up data dating back 6 months from programs like Chrome, VSCode, PowerQuery, Edge, Adobe, Excel, WinGet and many others. Programs that crash are expected to leave this directory in a non empty state. It's not "illegal" to crash so it's not "illegal" to leave the %TEMP% directory non-empty. That is why Storage Sense (but also commercial tools like CCleaner, which basically commercialized cleaning this directory) exist.

p.s. saying "we don't care about the common good practice" is not a good behavior.

If you feel we have insulted you in any way, please feel free to follow the code of conduct provisions both for this project and Julia Community here.

I hope we can resolve the issue soon!

donovaly commented 3 days ago

Note that this software is provided as is, without warranty of any kind (see the license).

What is going on? I never raised any license issues.

I just reported what I think is a bug. I made clear why I think so, there there is a common good practice, I made a proposal how to resolve it. I am not offended and I did not offend anybody.

In the end I am surprized about your self-understanding in the way you develop. All I wanted is to take my report, evaluate it, discuss it internally, then come up with a decision. But my report was immediately closed as "not planned".

Looking at my %TEMP% directory, I see non-cleaned up data dating back 6 months from programs like Chrome, VSCode, PowerQuery, Edge, Adobe, Excel, WinGet and many others.

That does not mean this is the right way. I also wonder about this as I also use VS Code, Edge and Adobe Reader and don't see this. However, I think you agree that for the user it is important to

We are all volunteers, nobody pressurizes you. If you like the feature request, keep it e.g. as an enhancement issue in the issue tracker.