YourKit 2021.11 crashes JVM 17 in Docker

Questions about YourKit Java Profiler
Locked
ykudryashov
Posts: 2
Joined: Mon Jan 17, 2022 8:04 am

YourKit 2021.11 crashes JVM 17 in Docker

Post by ykudryashov »

YourKit 2021.11 seems to crash Amazon Corretto JVM when run in Docker under WSL2.

Sample reproduction case below.

Dockerfile:

Code: Select all

FROM amazoncorretto:17-alpine

RUN wget https://www.yourkit.com/download/docker/YourKit-JavaProfiler-2021.11-docker.zip -P /tmp/ && \
    unzip /tmp/YourKit-JavaProfiler-2021.11-docker.zip -d /usr/local && \
    mv /usr/local/YourKit-JavaProfiler-2021.11 /usr/local/YourKit && \
    rm /tmp/YourKit-JavaProfiler-2021.11-docker.zip
RUN apk add --no-cache libc6-compat
COPY Test.java ~/Test.java
WORKDIR ~/
RUN javac Test.java
ENV LD_LIBRARY_PATH=/lib64
ENTRYPOINT ["java", "-cp",  "~/*",  "-agentpath:/usr/local/YourKit/bin/linux-x86-64/libyjpagent.so=port=15500,listen=all", "Test"]
Test Java program:

Code: Select all

public class Test {
    public static void main(String[] args) throws InterruptedException {
        while (true) {
            Thread.sleep(1000);
            System.out.println("Active");
        }
    }
}
Image is built with:

Code: Select all

docker build . -t test:test
Container is run with:

Code: Select all

docker run --mount type=bind,source=/mnt/c/temp/test/log,target=/root/.yjp/log test:test
Result: application is not started, the following is printed:

Code: Select all

[YourKit Java Profiler 2021.11-b225] Log file: /root/.yjp/log/Test-1.log
terminate called after throwing an instance of 'std::system_error'
  what():  No error information
I can send the full YourKit agent log, there's nothing suspicious there:

Code: Select all

21.11-225 0.003: Command line:
  java
  -cp
  ~/*
  -agentpath:/usr/local/YourKit/bin/linux-x86-64/libyjpagent.so=port=15500,listen=all
  Test
21.11-225 0.003: Executable: /usr/lib/jvm/java-17-amazon-corretto/bin/java
21.11-225 0.003: uname:
  sysname: Linux
  release: 5.10.60.1-microsoft-standard-WSL2
  version: #1 SMP Wed Aug 25 23:20:18 UTC 2021
  machine: x86_64
21.11-225 0.003: Linux; linux-x86-64; 64-bit process
21.11-225 0.004: hid: 3602619757ZX889997VXYYZUUZU6813676 64-bit machine
21.11-225 0.004: RAM: 31910 MB
21.11-225 0.004: Today is 20220117
21.11-225 0.004: full_build_stamp: 2021.11.225 202201131459
21.11-225 0.004: Agent library path: /usr/local/YourKit/bin/linux-x86-64/libyjpagent.so
21.11-225 0.005: getTimeNsInfo: "monotonic"
21.11-225 0.005: Agent_OnLoad: orig_options=port=15500,listen=all
  full_options=port=15500,listen=all
21.11-225 0.005: jvmtiVersion: 30110000
21.11-225 0.005: phase: 1
21.11-225 0.005: vendor: Amazon.com Inc.
21.11-225 0.005: version: 17.0.1+12-LTS
21.11-225 0.005: specVersion: 17
21.11-225 0.005: info: mixed mode, sharing
21.11-225 0.006: heap_sampling: capability is available
21.11-225 0.006: asynchronous sampling: available
21.11-225 0.006: inside Kubernetes: 0
21.11-225 0.006: session GUID: 5937373872
21.11-225 0.007: line_method: 1
21.11-225 0.007: heap_sampling: will be used instead of BCI
21.11-225 0.012: Jar file created: /tmp/yjp202201131459.jar
21.11-225 0.012: JVMTI 30110000; 17.0.1+12-LTS; Amazon.com Inc.; mixed mode, sharing; Java version: 17

>>SKIPPED

21.11-225 0.229: setTriggers: to unregister: 0
21.11-225 0.229: setTriggers: method listeners to register: 0
21.11-225 0.229: setTriggers: OK
21.11-225 0.230: ourUnsafe: true
21.11-225 0.246: agentInit: Core.init() called
21.11-225 0.246: Retransform early class: java/io/FileInputStream
21.11-225 0.247: [ssl-config] generating SSL certificate...
21.11-225 0.247: [ssl-config] OpenSSL 1.1.1m  14 Dec 2021
21.11-225 0.250: Retransform early class: java/io/FileOutputStream
21.11-225 0.252: Retransform early class: java/lang/Thread
21.11-225 0.257: Retransform early class: java/lang/ClassLoader
21.11-225 0.268: agentInit: OK
21.11-225 0.268: vmInit: 3
21.11-225 0.268: onStartProfiling: entering...
21.11-225 0.268: onStartProfiling: done
21.11-225 0.269: vmInit: OK
21.11-225 0.290: SP: pin java.io.FileNotFoundException
21.11-225 0.292: SP: pin java.security.PrivilegedActionException
21.11-225 0.292: SP: pin java.lang.ClassNotFoundException
21.11-225 0.324: [ssl-config] generating SSL certificate done: ctx 2, big 0, key 74, serial 0, cert 0, sign 1, use 0
21.11-225 0.324: [server] listening; port=15500; ip=0.0.0.0; url=https://127.0.0.1:15500
21.11-225 0.325: [shmem] get size result=1, size=0
21.11-225 0.325: [shmem] mapped address=00007F729C168000, mapped size=106500, area size=106500
21.11-225 0.330: *** HINT ***: To get profiling results, connect to the application from the profiler UI

>>END OF LOG
This happens both with Alpine and Amazon Linux-based images of Amazon Corretto JVM. There are no issues with JVM 11 and YourKit 2021.3.
ykudryashov
Posts: 2
Joined: Mon Jan 17, 2022 8:04 am

Re: YourKit 2021.11 crashes JVM 17 in Docker

Post by ykudryashov »

Here's the similar issue posted to SO: https://stackoverflow.com/questions/702 ... it-2021-11

The guy there solved the problem by using a Debian-based image - this is something we're not willing to do (Amazon doesn't publish 'official' Debian-based Corretto images).
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: YourKit 2021.11 crashes JVM 17 in Docker

Post by Anton Katilin »

Hi,

We have reproduced the problem, we're working on a fix.

Until the fix is ready, using a non-alpine image is the only known workaround.

Best regards,
Anton
Locked