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

JVM (OpenJDK 11) fails to start when JFR is enabled #243

Open
laszlocsontos opened this Issue Oct 12, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@laszlocsontos

laszlocsontos commented Oct 12, 2018

This is a bug in the current openjdk-11-jdk package Debian provides.
Related bug report: JVM fails to start when JFR is enabled

How to reproduce

% docker run openjdk:11 \
  java -XX:StartFlightRecording=disk=true,dumponexit=true,filename=/tmp/test.jfr -version

Could not parse setting default
Error occurred during initialization of VM
Failure when starting JFR on_vm_start

Analysis

The problem is caused by missing JFC files from the OpenJDK installation.

Another JDK installation which I created form the official tarball has
the following files:

# ls -l /opt/jdk-11/lib/jfr/
total 56
-rw-r--r-- 1 668 668 28012 Aug 23 03:57 default.jfc
-rw-r--r-- 1 668 668 27963 Aug 23 03:57 profile.jfc

On the other hand, that one I'm having the problem with doesn't even have
the JFR folder

# ls -l /usr/lib/jvm/java-11-openjdk-amd64/lib/jfr
ls: cannot access '/usr/lib/jvm/java-11-openjdk-amd64/lib/jfr': No such file or directory

Wordaround

Build a custom container image and add the following RUN statement after FROM openjdk:11.

# Workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910804
RUN mkdir -p /docker-java-home/lib/jfr && \
    wget https://hg.openjdk.java.net/jdk/jdk11/raw-file/76072a077ee1/src/jdk.jfr/share/conf/jfr/default.jfc \
      -O /docker-java-home/lib/jfr/default.jfc && \
    wget https://hg.openjdk.java.net/jdk/jdk11/raw-file/76072a077ee1/src/jdk.jfr/share/conf/jfr/profile.jfc \
      -O /docker-java-home/lib/jfr/profile.jfc

The default JFR profile will be found after that.

% docker run 637bba0e215b java -XX:StartFlightRecording=disk=true,dumponexit=true,filename=/tmp/test.jfr -version 
Started recording 1. No limit specified, using maxsize=250MB as default.

Use jcmd 1 JFR.dump name=1 to copy recording data to file.
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment (build 11+28-Debian-3)
OpenJDK 64-Bit Server VM (build 11+28-Debian-3, mixed mode, sharing)

Related PR: #244

@tianon

This comment has been minimized.

Member

tianon commented Oct 30, 2018

This appears to work great out-of-the-box on openjdk:11-oracle (introduced in #235), so I'd recommend giving that a shot if it works for your use case. At the very least, you could use openjdk:11-oracle's jlink to generate yourself a minimal JRE to then use in Debian (if Debian is a requirement). 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment