Skip to content
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

Temporary files are not deleted if TemporaryFile objects are not garbage collected #5545

Closed
chunyang opened this issue Feb 2, 2016 · 4 comments
Closed
Milestone

Comments

@chunyang
Copy link

@chunyang chunyang commented Feb 2, 2016

Temporary files are not deleted from disk unless the corresponding TemporaryFile objects are garbage collected. When garbage collection is not run in a timely manner, the files accumulate on disk and can lead to a denial of service.

The problem is exacerbated for requests that exceed maxDiskBuffer as handles to the temporary files are never passed to client code, so the client does not have an opportunity to delete the files.

@richdougherty
Copy link
Member

@richdougherty richdougherty commented Feb 2, 2016

I agree this is a problem, see my comment from here:

…I don't really like the way the delete happens in a finalize method. I'd like us to have a better way of cleaning up resources when a request finishes. Maybe each request could have an object where we could add "request finished" hooks.

@wsargent
Copy link
Member

@wsargent wsargent commented Feb 2, 2016

Possibly a dup of #5459

@mkurz
Copy link
Member

@mkurz mkurz commented Mar 6, 2016

Related: #4707, #3913, #6786 and #4762
Also this comment:

I'd rather the user explicitly does something if they want to keep it around after the request is complete, e.g. some sort of acquire/release operation, or maybe moving the file elsewhere.

As discussed in one of the above issues I am assigning the Play 3 milestone.

@mkurz mkurz added this to the 3.0.0 milestone Mar 6, 2016
@mkurz mkurz added this to the 2.5.13 milestone Feb 15, 2017
@mkurz mkurz removed this from the 3.0.0 milestone Feb 15, 2017
@mkurz mkurz added this to the 3.0.0 milestone Feb 15, 2017
@mkurz mkurz removed this from the 2.5.13 milestone Feb 15, 2017
@gmethvin gmethvin added this to the 2.7.0 milestone Jun 22, 2017
@gmethvin gmethvin removed this from the 3.0.0 milestone Jun 22, 2017
@wsargent
Copy link
Member

@wsargent wsargent commented Jun 23, 2017

This can be handled by enabling the TemporaryFileReaper in 2.6.x: https://www.playframework.com/documentation/2.6.x/ScalaFileUpload#Cleaning-up-temporary-files

@wsargent wsargent closed this Jun 23, 2017
@mkurz mkurz added this to the 2.6.0 milestone Jun 26, 2017
@mkurz mkurz removed this from the 2.7.0 milestone Jun 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants