Skip to content

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

Closed

Description

@chunyang

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.

Activity

  1. richdougherty commented on Feb 2, 2016

    @richdougherty
    Member

    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.

  2. wsargent commented on Feb 2, 2016

    @wsargent
    Member

    Possibly a dup of #5459

  3. mkurz commented on Mar 6, 2016

    @mkurz
    Member

    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.

  4. added this to the 3.0.0 milestone on Mar 6, 2016
  5. modified the milestones: 2.5.13, 3.0.0 on Feb 15, 2017
  6. modified the milestones: , 3.0.0 on Jun 22, 2017
  7. wsargent commented on Jun 23, 2017

    @wsargent
    Member

    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

  8. modified the milestones: 2.6.0, on Jun 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions