This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.0.x by this push: new 95ccb72 Workaround JVM bug described in BZ 65710 95ccb72 is described below commit 95ccb729ecfb61cb8ee2c94b793c05b0d8c1949f Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Dec 2 08:27:31 2021 +0000 Workaround JVM bug described in BZ 65710 In Java 8 (but not Java 11) Files.newInputStream(dfos.getFile().toPath()) leaks a file descriptor even after GC if the input stream is not explicitly closed. https://bz.apache.org/bugzilla/show_bug.cgi?id=65710 --- java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java | 4 +++- webapps/docs/changelog.xml | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java b/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java index 4dcc3d9..521abaf 100644 --- a/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java +++ b/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java @@ -193,7 +193,9 @@ public class DiskFileItem public InputStream getInputStream() throws IOException { if (!isInMemory()) { - return Files.newInputStream(dfos.getFile().toPath()); + // Uses old code to avoid JVM bug + // https://bz.apache.org/bugzilla/show_bug.cgi?id=65710 + return new FileInputStream(dfos.getFile()); } if (cachedContent == null) { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 9c047e3..580a3e3 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -132,6 +132,12 @@ Add debug logging to the <code>RestCsrfPreventionFilter</code>. Based on pull request <pr>452</pr> by Polina Georgieva. (markt) </add> + <add> + <bug>65710</bug>: Implement a workaround for a JVM bug that can trigger + a file descriptor leak when using multi-part upload and the application + does not explicitly close an input stream for an uploaded file that was + cached on disk. (markt) + </add> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org