RFR: JDK-8197398 (zipfs) OutOfMemoryError when talking contents of empty JAR file
deepak.kejriwal at oracle.com
Tue Nov 27 09:51:09 UTC 2018
Hi nio-dev team,
Gentle reminder for review of below fix.
From: Deepak Kejriwal <deepak.kejriwal at oracle.com>
Sent: Thursday, November 8, 2018 12:17 AM
To: 'nio-dev at openjdk.java.net' <nio-dev at openjdk.java.net>
Subject: RFR: JDK-8197398 (zipfs) OutOfMemoryError when talking contents of empty JAR file
Please help review the changes for JDK-8199776 to JDK8u:-
Master Bug: https://bugs.openjdk.java.net/browse/JDK-8199776
The Files.walkFileTree walk indefinitely while processing JAR file with "/" as a directory inside.
Files.walkFileTree api for jar internally uses ZipfileSystem. While iterating over the zip entries we have added a check to see if entry name is equal to "/" (absolute path). If the entry name is equal to "/" we don't add it to "inodes" map so that we don't end up with infinite loop.
We have similar bug HYPERLINK "https://bugs.openjdk.java.net/browse/JDK-8197398"JDK-8197398 fixed in jdk 12. Below is the difference between fix for jdk 12 and jdk 8:-
The fix for above issue for jdk 12 handle a case where we can update an existing entry in jar with "/" (absolute path). As in case of jdk 8 we cannot update the existing zipentry as doing so we get "FileAlreadyExistsException". Therefore, fix for jdk 8u does not consider this case.
More information about the core-libs-dev