Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-8395

File descriptors leak in MultiPartParserDefinition

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.0.DR12
    • None
    • Undertow
    • None
    • Low
    • 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)

      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()

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

                Created:
                Updated:
                Resolved: