Uploaded image for project: 'Commons FileUpload'
  1. Commons FileUpload
  2. FILEUPLOAD-48

[fileupload] Memory leak in DefaultFileItem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0 Final
    • None
    • None
    • Operating System: Windows 2000
      Platform: PC

    • 34373

    Description

      Scenario:
      Use FileUpload library in a servlet implementation for multipart request
      parsing.
      Launch stress test in order to submit a lot of Post Http request with many
      parameters and file to upload.
      Environment: Windows (2000 or XP) with Sun JVM or IBM JVM 1.4.x

      Problem:
      After few hours the server crash with an out of memory exception.
      The HeapDump of the jvm at the crash time shows that a lot of memory is still
      available in the java heap.
      This out of memory is due to an out of memory of the java native heap.
      Sample of exception message:
      [Signaling in VM: java/lang/OutOfMemoryError, message:
      JVMCI015:OutOfMemoryError, cannot create anymore threads due to memory or
      resource constraints]

      Cause and solution:
      The problem seems to be due to the File.deleteOnExit() call used in the
      DefaultFileItem class.
      This call is used in order to delete temporary file at the exit of the JVM.
      This call seems to create memory leak in native heap on Windows OS (We didn't
      test it on Linux or Unix)
      Moreover this is not usefull to let file destruction on exit of the jvm on a
      server.
      In order to delete temporary file created by DefaultFileItem, a cleanup method
      should be added,
      or a cleanup of the temporary files should be provided, but not the
      File.deleteOnExit() method.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sgrenier@triloggroup.com Sandra Grenier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: