-
Notifications
You must be signed in to change notification settings - Fork 197
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
Files piling up in _temporary_compressed_files folder #655
Comments
It seems to me that there are probably three points where files should be cleaned up:
Number 1 is easy, just add code similar to the following to startWebServerAsync:
For number 2, add similar code to shutdown (doesn't need to be async, obviously), but I'm not exactly sure were is the best place to add this. Number 3 strikes me as a tricky problem. It's easy enough monitor the size, then determine what the oldest files are that should be deleted , but how to be sure it's safe to delete them? Unless maybe Suave starts keeping track of compressed files being served in another queue somewhere, which can be checked to make sure a file is not being served anymore and can be safely deleted? |
|
|
@haf Actually even the FileShare.Read that transformStream() uses is sufficient to prevent deletion (I tested just to make sure). So I think that removes some of the trickiness of number 3. Also it means I can safely try to delete the old uncompressed file when a new one is created. I searched the Logary repo for "FileTarget" but didn't find anything :) I don't think there is any real place where "shutdown" type code executes in Suave. The closest I could see would be Tcp.runServer(), that would be only if it's shut down via cancellation token, and in any event this code doesn't really belong there. But, I think it's sufficient that the server will clean up the next time it starts, and a developer could easily add a few lines to his own app to clean this up after stopping the server, if he thinks it's really needed. Assuming you agree, I can modify the PR and that would leave number 3, managing the size of the folder. Any suggestions on that? Just fire off a timer and check once a minute? Add size to configuration, what is best default, etc.? |
The file target is here https://github.com/logary/logary/blob/master/src/Logary/Targets_Core.fs#L816 General guidelines:
I generally don't like timers, but in this case they are probably necessary.
|
Just wondering if there's been any progress on this? Seems like this could be a real problem in a production environment. I just checked and have half a gig of dead temp files on a very low-traffic website. |
@brianberns I don't think anyone has taken a stab at this; no. |
I was playing with the WebSocket example (netcoreapp2.0) and noticed some unfortunate effects. I run the example by
It looks like .NET SDK uses Suave.dll right from the package cache directory, namely from
And it looks like Suave As a result after a few runs of the example I find several compressed files right in the package directory:
|
I'm using Suave.io as a web server in a shared hosting environment. I've noticed that files created in the
_temporary_compressed_files
folder are never getting deleted. The documentation says "Suave deletes these files once they are served, so their lifetime is usually less than a second," but this is not occurring and I cannot see anywhere in the Suave code where this is implemented. What can I do to make sure these files get deleted in a timely fashion?The text was updated successfully, but these errors were encountered: