JDK-8215123 : Crash in runtime image built with jlink --compress=2
  • Type: Bug
  • Component: tools
  • Sub-Component: jlink
  • Affected Version: 12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: x86
  • Submitted: 2018-12-10
  • Updated: 2019-11-25
  • Resolved: 2018-12-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12 JDK 13
11.0.4Fixed 12 teamFixed 13Fixed
Related Reports
Relates :  
Description
If one creates a Zip-compressed runtime image using jlink, java always crashes.

Steps to reproduce:
1. Create a runtime image:
images/jdk> bin/jlink --compress=2 --add-modules=java.base --output jrebase

2. Run java -version from the image:
images/jdk> jrebase/bin/java -version
Execution protection violation
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000043d, pid=14308, tid=23724
#
# JRE version:  (12.0+99) (build )
# Java VM: Java HotSpot(TM) Server VM (12-sustaining+99, mixed mode, emulated-client, g1 gc, windows-x86)
# Problematic frame:
# C  0x0000043d
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\ade\work\jdk-dev\build\windows-x86-server-release\images\jdk\hs_err_pid14308.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#


jimage.dll looks up ZIP_InflateFully [1][2] function from zip.dll dynamically. JDK-8201226 removed JNICALL (__stdcall) modifier from ZIP_InflateFully [3][4] to overcome __stdcall name mangling on Win32.

It stopped working since JDK-8200178 which removed /export options to the linker [5] because the mangled name was exported. Therefore the function ZIP_InflateFully would not be found.


When using --compress={0,1}, the resulting image does not crash.

[1] http://hg.openjdk.java.net/jdk/jdk/file/f94c7929a44b/src/java.base/share/native/libjimage/imageDecompressor.cpp#l41
[2] http://hg.openjdk.java.net/jdk/jdk/file/f94c7929a44b/src/java.base/share/native/libjimage/imageDecompressor.cpp#l85
[3] http://hg.openjdk.java.net/jdk/jdk/rev/e0af66d6e968#l6.63
[4] http://hg.openjdk.java.net/jdk/jdk/rev/e0af66d6e968#l7.43
[5] http://hg.openjdk.java.net/jdk/jdk/rev/396ea30afbd5#l2.97
Comments
Fix Request: This should be backported to jdk11. Patch applies cleanly. Request came in on mailing list: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2019-March/000723.html
06-03-2019

This issue has been reported to AdoptOpenJDK and raised on the mailing list [6] by Ali ��nce. [6] http://mail.openjdk.java.net/pipermail/build-dev/2018-December/024300.html
10-12-2018