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

Comments

Projects
None yet
5 participants
@chunyang
Copy link

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

wsargent commented Feb 2, 2016

Possibly a dup of #5459

@mkurz

This comment has been minimized.

Copy link
Member

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 modified the milestones: 2.5.13, 3.0.0 Feb 15, 2017

@gmethvin gmethvin modified the milestones: 2.7.0, 3.0.0 Jun 22, 2017

@wsargent

This comment has been minimized.

Copy link
Member

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 modified the milestones: 2.6.0, 2.7.0 Jun 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.