-
Notifications
You must be signed in to change notification settings - Fork 239
8315135: Memory leak in the native implementation of Pack200.Unpacker.unpack() #2100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back simonis! A progress list of the required criteria for merging this PR into |
/contributor add Yakov Shafranovich yakovsh@amazon.com |
@simonis |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall.
The test doesn't use the formatting conventions of OpenJDK Java code, though. Indentation should be 4 spaces and also a space between if
and the following (
is missing. Please clean this up before integrating.
Thanks for looking into this @RealCLanger. I've updated the indentation as requested. |
src/java.base/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
Show resolved
Hide resolved
…if NativeUnpack::finish() is called more than once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, Volker. I agree, passing false
as value to noCreate seems odd. But a default parameter as negation in itself is odd.
@simonis This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 7 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/backport jdk8u-dev |
@simonis Backport for repo |
/integrate |
Going to push as commit b77c161.
Your commit was automatically rebased without conflicts. |
Creating backport for repo openjdk/jdk8u-dev on branch master /backport openjdk/jdk8u-dev master |
@openjdk[bot] @simonis Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk8u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk8u-dev with the title |
/backport openjdk/jdk11u |
@simonis the backport was successfully created on the branch simonis-backport-b77c161e in my personal fork of openjdk/jdk11u. To create a pull request with this backport targeting openjdk/jdk11u:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u:
|
This issue was found by Yakov Shafranovich (yakovsh@amazon.com) who also provided the reproducer and proposed a fix.
The native implementation of the
Pack200.Unpacker
class included in OpenJDK 8 and 11 has a native and heap memory leak that gets triggered when corrupted files are processed. If the nativeNativeUnpack::start()
method throws an exception (because of a corrupted input file) its callerNativeUnpack::run()
fails to call the nativeNativeUnpack::finish()
method which is responsible for freeing the allocated native memory and releasing the created global JNI handles. A Java application processing large number of malformed Pack200 files will eventually run either out of native memory or out of heap space and exit with anOutOfMemoryError
.The problem can be demonstrated with the following short test program which will exit with an
OutOfMemoryError
quite quickly if run withjava -Xmx32m NativePack200POC
:The problem can be worked around by disabling the native Pack200 implementation with
-Dcom.sun.java.util.jar.pack.disable.native=true
but the default setting is-Dcom.sun.java.util.jar.pack.disable.native=false
.Notice that this bug can not be fixed in HEAD because the Pack200 functionality has been removed in JDK 14 (https://openjdk.org/jeps/367). I therefore propose to fix this in jdk11u-dev first and then downport the fix to jdk8u-dev as well.
Progress
Issue
Reviewers
Contributors
<yakovsh@amazon.com>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/2100/head:pull/2100
$ git checkout pull/2100
Update a local copy of the PR:
$ git checkout pull/2100
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/2100/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2100
View PR using the GUI difftool:
$ git pr show -t 2100
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/2100.diff
Webrev
Link to Webrev Comment