Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-961

File descriptors leak in MultiPartParserDefinition

    XMLWordPrintable

Details

    • Hide

      Deploy application, that can receive file uploads and upload many files with size that exceeds limit. Default limit is 10Mb. Exception is thrown:
      java.io.IOException: UT000054: The maximum size 10485760 for an individual file in a multipart request was exceeded
      at io.undertow.server.handlers.form.MultiPartParserDefinition$MultiPartUploadHandler.data(MultiPartParserDefinition.java:266)
      at io.undertow.util.MultipartParser$IdentityEncoding.handle(MultipartParser.java:332)

      Show
      Deploy application, that can receive file uploads and upload many files with size that exceeds limit. Default limit is 10Mb. Exception is thrown: java.io.IOException: UT000054: The maximum size 10485760 for an individual file in a multipart request was exceeded at io.undertow.server.handlers.form.MultiPartParserDefinition$MultiPartUploadHandler.data(MultiPartParserDefinition.java:266) at io.undertow.util.MultipartParser$IdentityEncoding.handle(MultipartParser.java:332)
    • Low

    Description

      If some exception is thrown while uploading file (for example, file size limit exceeded), then file deleted, but file channel is not closed. Linux lsof command shown a growing number of descriptors. I solved this problem by modifying io.undertow.server.handlers.form.MultiPartParserDefinition$MultiPartUploadHandler.parseBlocking()
      exchange.putAttachment(FORM_DATA, data);
      } catch (IOException e) {
      try {
      if (fileChannel != null)

      { fileChannel.close(); }

      } catch (Throwable ignored) {
      }
      throw e;
      }
      Added fileChannel.close(). May be, this code need to be moved in MultiPartUploadHandler.close()

      Attachments

        Issue Links

          Activity

            People

              sdouglas1@redhat.com Stuart Douglas
              bobzer Vladimir Smirnov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: