New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean out the SquirrelTemp folder #1195
Comments
This folder cleans itself up, but if you had a lot of failed installations / upgrades that might not happen. There are no repercussions to deleting this folder, sorry about the disk space |
This continues to be an issue for me. I'm using GitHub Desktop (uses Squirrel) and I get a ridiculous number of "temp" folders with over 6GB of files. SquirrelTemp folder Please improve the cleanup and the update attempt logic. |
Out of curiosity @hl2guide, do you know if all those folders belong specifically to GitHub Desktop updates and not to any other apps? |
13 GB for me. So much for "temp". Essentially all of these seem due to GitHub Desktop. I filed a bug report to them as well. (Still an awesome Git client regardless.) I guess what I'm looking at here is an historical overview of Github Desktop application size over the course of the past 4-5 years. 😂 |
Same for me, my laptop has very little storage to begin with and I had over 177k files from that folder. |
Once again, this is due to files being locked - given that this only happens to GitHub Desktop I would guess that they need to change something |
@sergiou87 yes, they are all GitHub Desktop temps. |
@anaisbetts thanks for the hint! I've tried to reproduce the issue by locking different files, and in all cases the two temp folders are deleted. If the locked file is the "execution stub", I see a line in the logs for it:
In general, looking at the code (and unless I'm missing something), seems like both folders should be deleted after a failed installation in any case, since the two temp folders created are in a Squirrel.Windows/src/Squirrel/DeltaPackage.cs Lines 62 to 63 in 7396fa5
However, I was able to repro the problem with this other hint from one of our users: if I close GitHub Desktop while Squirrel.Windows is either preparing or installing the release, those temp folders are left there forever. I'm not an expert in C#, but I guess Can you think of a proper way of fixing this from Squirrel.Windows? Otherwise, from GitHub Desktop I can only think of preventing the user from closing the app while an update is being installed 🤔 |
My fork of Squirrel has solved this particular issue in two ways:
Of course, in most cases, neither of the above are necessary. I have taken great care to eagerly clean up temporary files as soon as possible, but it feels good to know that if something does go drastically wrong, those files will still eventually get cleaned up. |
Yikes, have you tried this in production? Temp is often an Extremely Cursed directory (missing, pointing to something insane, broken permissions, the env var being pointed to something like "@#$I@#J", the list goes on). Also, from an antivirus perspective, you are extracting PE files to Temp then attempting to move them into place, which is nearly indistinguishable from malware |
Interesting point of view, and worth contemplating. Of course I'm not just using the environment variable, but it's being used in production by myself and a few very large open source projects, so probably hundreds of thousands of installs if not more all over the world and I've not heard anything about this being an issue. Occasionally get reports of the installer failing in weird ways because it ran out of disk space (so we now check this before extracting anything), and we had a few unicode problems in other parts of the world that are now resolved. Even if the Squirrel temp files were still in app data, having Squirrel clean them up / reuse folder names at next install/update also solves this problem. |
1 GB of "temp" files for me, GitHub Desktop was installed |
Hopefully, desktop/desktop#15416 will help with this. We think this happens because GitHub Desktop is closed while it's updating the app, and the temp installation files are left there forever 😕 |
Actually to be honest @sergiou87, I would instead guess that you're trying to call Instead, it would be better if you ran the update in the background, when the app is idle (Electron's autoUpdater is heavily based on Squirrel.Mac which unfortunately can't do this, but you could invoke |
But if I do that, it will reopen the app, no? 🤔 In that scenario, the user is waiting for the app to install the update and close itself, and IIRC when the app is opened again, the new version will be installed, right?
Interesting, thanks! I'll look into this, because I didn't consider that scenario 😨 However, running the update in the background wouldn't help in this situation, right? It'd be exactly the same problem, unless I'm missing something 🤔 At least, the problem I've seen is when the app is closed after the update has been downloaded and before the The app already checks for updates every 4h, and immediately downloads them if available (to then wait for users to quit / restart the app). Does that make sense? |
It would, because if you're idling you're vaguely sure that the machine isn't shutting down, whereas if you're doing it on app close, that is actually often a hint that the machine is shutting down. Unlike Squirrel.Mac which always waits until app close to apply the update, Squirrel.Windows can fully apply an update while the app is running. So on Windows, it makes sense to try to wait until the app is idle but still running, then fully download and apply updates. Squirrel.Windows does updates out-of-process, so closing the app actually shouldn't cancel updates, though node.js/Electron may be explicitly or inadvertently closing all spawned processes from the main app. You may be able to get around this via directly calling |
That makes total sense, thanks!! In this case, we're trying to mitigate the issue on Windows (we haven't had reports of anything similar happening on macOS), so I hope the current approach is good enough for that, as the update is being applied with the app running thanks to those checks every 4h. This, however, is interesting:
because I've definitely seen the update process being interrupted when I close the app (and therefore leaving the temp files and sometimes even a corrupted installation 😕 ) After chatting with @niik about this, we're gonna try this out without explicitly invoking In any case, thanks a lot for your feedback, it super helpful! ❤️ |
This will never break, the location and name of Update.exe is Guaranteed™️ for compatibility purposes |
@jaywalker291 yes, you can delete it manually. Those are just installer files. Squirrel is what some apps use to auto-update, and sometimes the process can fail and leave those temp files behind. |
I was analyzing my SSD today and found that my
c:\Users\{user}\AppData\Local\SquirrelTemp
folder had over 2 GB of "temp" files. I deleted them all, darn the repercussions, because I needed the room. Is there something in place to clean up this folder? I don't want to remember to check on it every month or so and have to clean it out.The text was updated successfully, but these errors were encountered: