Skip to content
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

jdk.VirtualThreadPinned JFR event NOT supported in native-image #8978

Closed
buuuuuuug opened this issue May 27, 2024 · 2 comments
Closed

jdk.VirtualThreadPinned JFR event NOT supported in native-image #8978

buuuuuuug opened this issue May 27, 2024 · 2 comments
Assignees

Comments

@buuuuuuug
Copy link

Describe the issue
As descibed in issue5410, graalvm jdk21 should have supported jdk.VirtualThreadPinned
event in native-image mode.
However it does not!

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. [https://github.com/buuuuuuug/jfr-vth-pin.git]
  2. [gradle build]
  3. [java -jar build/libs/jfr-vth-pin-0.0.1-SNAPSHOT.jar]
  4. [curl --request POST --url 'http://localhost:8080/pinning] this will cause a vth pinned. As expected, the VirtualThreadPinned event should be captured in JfrVirtualThreadPinnedEventHandler.class.
  5. [gradle nativeCompile] build in native-image mode
  6. [./build/native/nativeCompile/jfr-vth-pin -XX:StartFlightRecording="filename=recording.jfr,settings=continue+vth.jfc"]
  7. [curl --request POST --url 'http://localhost:8080/pinning] this time, the VirtualThreadPinned event is not captured.

Describe GraalVM and your environment:

  • GraalVM Oracle 21.02
  • JDK major version: [21]
  • OS: [macOS Monterey] [Ubuntu 22.04]
  • Architecture: [AMD64]

More details
build log

chaney@chaneydeiMac-Pro jfr-vth-pin % ./gradlew nativeCompile

> Task :processAot
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.3.0)

2024-05-27T22:07:41.721+08:00  INFO 6870 --- [jfr-vth-pin] [           main] c.chaney.jfrvthpin.JfrVthPinApplication  : Starting JfrVthPinApplication using Java 21.0.2 with PID 6870 (/Users/chaney/IdeaProjects/jfr-vth-pin/build/classes/java/main started by chaney in /Users/chaney/IdeaProjects/jfr-vth-pin)
2024-05-27T22:07:41.723+08:00  INFO 6870 --- [jfr-vth-pin] [           main] c.chaney.jfrvthpin.JfrVthPinApplication  : No active profile set, falling back to 1 default profile: "default"

> Task :nativeCompile
[native-image-plugin] GraalVM Toolchain detection is disabled
[native-image-plugin] GraalVM location read from environment variable: JAVA_HOME
[native-image-plugin] Native Image executable path: /Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/bin/native-image
Apply jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/6.1.8/1461405dc325c82a0a058df033bee3d8c6dd6e41/spring-web-6.1.8.jar!/META-INF/native-image/org.springframework/spring-web/native-image.properties
Apply jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/6.1.8/141fc11a5dbaa503fe361150312ad0fa9d9c03da/spring-core-6.1.8.jar!/META-INF/native-image/org.springframework/spring-core/native-image.properties
Apply jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-core/1.13.0/d7ed656fbc54fde5a03d978fc0d66f270cc4a997/micrometer-core-1.13.0.jar!/META-INF/native-image/io.micrometer/micrometer-core/reflect-config.json
Apply jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-core/1.13.0/d7ed656fbc54fde5a03d978fc0d66f270cc4a997/micrometer-core-1.13.0.jar!/META-INF/native-image/io.micrometer/micrometer-core/proxy-config.json
Apply jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.24/938419aba5a4f4645b9cd23a9e1d5453e85d09b9/tomcat-embed-websocket-10.1.24.jar!/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/native-image.properties
Apply jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.24/cd9358f0a26d26e1a2c7200f69cb9a302c20ceb4/tomcat-embed-core-10.1.24.jar!/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/native-image.properties
Apply jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-el/10.1.24/6e9c9dce63c10f903cb0aaaeff45f5f7092f5527/tomcat-embed-el-10.1.24.jar!/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/native-image.properties
Apply file:///Users/chaney/IdeaProjects/jfr-vth-pin/build/resources/aot/META-INF/native-image/com.chaney/jfr-vth-pin/native-image.properties
Apply file:///Users/chaney/IdeaProjects/jfr-vth-pin/build/resources/aot/META-INF/native-image/com.chaney/jfr-vth-pin/reflect-config.json
Apply file:///Users/chaney/IdeaProjects/jfr-vth-pin/build/resources/aot/META-INF/native-image/com.chaney/jfr-vth-pin/resource-config.json
Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: Please re-evaluate whether any experimental option is required, and either remove or unlock it. The build output lists all active experimental options, including where they come from and possible alternatives. If you think an experimental option should be considered as stable, please file an issue.
Apply jar:file:///Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/library-support.jar!/META-INF/native-image/com.oracle.svm/thirdparty/native-image.properties
Apply jar:file:///Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/library-support.jar!/META-INF/native-image/com.oracle.svm/polyglot/native-image.properties
Executing [
HOME=/Users/chaney \
'PATH=/Users/chaney/.sdkman/candidates/java/21.0.2-graal/bin:/Users/chaney/.sdkman/candidates/gradle/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/chaney/.cargo/bin:/Users/chaney/Library/Application Support/JetBrains/Toolbox/scripts:/Users/chaney/.orbstack/bin' \
PWD=/Users/chaney/IdeaProjects/jfr-vth-pin \
USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=true \
/Users/chaney/.sdkman/candidates/java/21.0.2-graal/bin/java \
-XX:+UseParallelGC \
-XX:+UnlockExperimentalVMOptions \
-XX:+EnableJVMCI \
-Dtruffle.TrustAllTruffleRuntimeProviders=true \
-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime \
-Dgraalvm.ForcePolyglotInvalid=true \
-Dgraalvm.locatorDisabled=true \
-Dsubstratevm.IgnoreGraalVersionCheck=true \
--add-exports=java.base/com.sun.crypto.provider=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.access=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.event=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.loader=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.logger=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.misc=com.oracle.svm.svm_enterprise,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.objectfile,org.graalvm.nativeimage.pointsto \
--add-exports=java.base/jdk.internal.module=org.graalvm.nativeimage.base,org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.org.objectweb.asm=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.perf=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.platform=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.ref=org.graalvm.nativeimage.builder,org.graalvm.nativeimage.objectfile \
--add-exports=java.base/jdk.internal.reflect=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.util=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.vm.annotation=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal.vm=org.graalvm.nativeimage.builder \
--add-exports=java.base/jdk.internal=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.invoke.util=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.net.www=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.net=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.nio.ch=org.graalvm.nativeimage.builder,org.graalvm.nativeimage.objectfile \
--add-exports=java.base/sun.reflect.annotation=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.reflect.generics.factory=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.reflect.generics.reflectiveObjects=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.reflect.generics.repository=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.reflect.generics.scope=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.reflect.generics.tree=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.security.jca=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.security.provider=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.security.ssl=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.security.util=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.security.x509=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.text.spi=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.util.calendar=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.util.cldr=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.util.locale.provider=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.util.locale=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.util.resources=org.graalvm.nativeimage.builder \
--add-exports=java.base/sun.util=org.graalvm.nativeimage.builder \
--add-exports=java.management/com.sun.jmx.mbeanserver=org.graalvm.nativeimage.builder \
--add-exports=java.management/sun.management=org.graalvm.nativeimage.builder,org.graalvm.nativeimage.pointsto \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.aarch64=com.oracle.graal.graal_enterprise,com.oracle.svm.svm_enterprise,jdk.internal.vm.compiler,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.objectfile \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.amd64=com.oracle.graal.graal_enterprise,com.oracle.svm.svm_enterprise,jdk.internal.vm.compiler,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.objectfile \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.code.site=com.oracle.svm.svm_enterprise,jdk.internal.vm.compiler,org.graalvm.nativeimage.builder \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.code.stack=jdk.internal.vm.compiler,org.graalvm.nativeimage.builder \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.code=com.oracle.graal.graal_enterprise,com.oracle.svm.svm_enterprise,jdk.internal.vm.compiler,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.objectfile,org.graalvm.nativeimage.pointsto,org.graalvm.truffle.compiler \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.common=com.oracle.graal.graal_enterprise,com.oracle.svm.svm_enterprise,jdk.internal.vm.compiler,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.pointsto \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot.aarch64=jdk.internal.vm.compiler \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot.amd64=jdk.internal.vm.compiler \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot=com.oracle.graal.graal_enterprise,jdk.internal.vm.compiler,org.graalvm.nativeimage.builder \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.meta=com.oracle.graal.graal_enterprise,com.oracle.svm.svm_enterprise,jdk.internal.vm.compiler,org.graalvm.nativeimage.base,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.objectfile,org.graalvm.nativeimage.pointsto,org.graalvm.truffle.compiler \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.runtime=com.oracle.graal.graal_enterprise,jdk.internal.vm.compiler,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.pointsto \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.services=com.oracle.graal.graal_enterprise,com.oracle.svm.svm_enterprise,jdk.internal.vm.compiler,org.graalvm.nativeimage.builder \
--add-exports=jdk.jfr/jdk.jfr.events=org.graalvm.nativeimage.builder \
--add-exports=jdk.jfr/jdk.jfr.internal.jfc=org.graalvm.nativeimage.builder \
--add-exports=jdk.jfr/jdk.jfr.internal=org.graalvm.nativeimage.builder \
--add-exports=jdk.management/com.sun.management.internal=org.graalvm.nativeimage.builder \
-XX:+UseJVMCINativeLibrary \
-Xss10m \
-XX:MaxRAMPercentage=25.50112009048462 \
-XX:GCTimeRatio=9 \
-XX:+ExitOnOutOfMemoryError \
-Djava.awt.headless=true \
'-Dorg.graalvm.vendor=Oracle Corporation' \
-Dorg.graalvm.vendorurl=https://www.graalvm.org/ \
'-Dorg.graalvm.vendorversion=Oracle GraalVM 21.0.2+13.1' \
-Dorg.graalvm.version=23.1.2 \
-Dcom.oracle.graalvm.isaot=true \
-Djava.system.class.loader=com.oracle.svm.hosted.NativeImageSystemClassLoader \
-Xshare:off \
-Djdk.internal.lambda.disableEagerInitialization=true \
-Djdk.internal.lambda.eagerlyInitialize=false \
-Djava.lang.invoke.InnerClassLambdaMetafactory.initializeLambdas=false \
--add-modules=ALL-DEFAULT \
--module-path \
/Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/builder/svm.jar:/Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/builder/native-image-base.jar:/Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/builder/objectfile.jar:/Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/builder/svm-enterprise.jar:/Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/builder/pointsto.jar \
--module \
org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner \
-keepalive \
/var/folders/zb/9kf451653mz7x5jjg7bbjfhr0000gn/T/.native_image6273126620382020175alive \
-imagecp \
/Users/chaney/IdeaProjects/jfr-vth-pin/build/libs/jfr-vth-pin-0.0.1-SNAPSHOT-plain.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-web/3.3.0/d8f587bc52e6c31dc4f161a49ce8f5e19f8853a9/spring-boot-starter-web-3.3.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-actuator/3.3.0/768a4f4e20c529f08e241b3ab5b316ab0567c30/spring-boot-starter-actuator-3.3.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-json/3.3.0/1c9938093b372602f121e2b073f490897388cc71/spring-boot-starter-json-3.3.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter/3.3.0/1af929e0fcb10c2bfc3f3619f4ca9049bd927b/spring-boot-starter-3.3.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-registry-prometheus/1.13.0/336a1b9f35722ffbe7988603c392f1c880c16925/micrometer-registry-prometheus-1.13.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-actuator-autoconfigure/3.3.0/993952c505a09c13a7fd996def6dbaf3bc6b06d9/spring-boot-actuator-autoconfigure-3.3.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-autoconfigure/3.3.0/1d98cfa94223e6a3a0e0ad301822cef90cc04fbc/spring-boot-autoconfigure-3.3.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-actuator/3.3.0/14696a25a7c6adc23836a6a1315f90bbafd23cd4/spring-boot-actuator-3.3.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot/3.3.0/83d42f81f312d71b9425f58d1d3f9e8970e51b22/spring-boot-3.3.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-logging/3.3.0/79a400c9d7ce3a7cecf296fda402e3100a099bce/spring-boot-starter-logging-3.3.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-tomcat/3.3.0/f9cdd6f3976d307e10cce065349e331d7162faf2/spring-boot-starter-tomcat-3.3.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/jakarta.annotation/jakarta.annotation-api/2.1.1/48b9bda22b091b1f48b13af03fe36db3be6e1ae3/jakarta.annotation-api-2.1.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-webmvc/6.1.8/8496f8c010625bc0b857d19d2e93a9bdd691c1af/spring-webmvc-6.1.8.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/6.1.8/1461405dc325c82a0a058df033bee3d8c6dd6e41/spring-web-6.1.8.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context/6.1.8/21219a0df58e5b96ef489a172b449232573352e8/spring-context-6.1.8.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aop/6.1.8/ef793a21e405a88d9d32b92cb459c845ee12b271/spring-aop-6.1.8.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/6.1.8/79a5e45383542ff514b5328fe277410cf4054f3b/spring-beans-6.1.8.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-expression/6.1.8/dcf78ef442c24f32ff8c6a9746e7f5209b330111/spring-expression-6.1.8.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/6.1.8/141fc11a5dbaa503fe361150312ad0fa9d9c03da/spring-core-6.1.8.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/2.2/3af797a25458550a16bf89acc8e4ab2b7f2bfce0/snakeyaml-2.2.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-jakarta9/1.13.0/5d6820df50cba9ef893bf026eacf5a6093945ac7/micrometer-jakarta9-1.13.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-core/1.13.0/d7ed656fbc54fde5a03d978fc0d66f270cc4a997/micrometer-core-1.13.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.prometheus/prometheus-metrics-core/1.2.1/362330b5934a128e91e331f1497cd275fec1a81c/prometheus-metrics-core-1.2.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.prometheus/prometheus-metrics-tracer-common/1.2.1/74cc4ac3226a3937d6e5c74c06454258e7901cec/prometheus-metrics-tracer-common-1.2.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.prometheus/prometheus-metrics-exposition-formats/1.2.1/64190364467197c39bcc296ec80a99f6c979a7dc/prometheus-metrics-exposition-formats-1.2.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-observation/1.13.0/5aa75fbb4367dc3b28e557d14535d21335dc8985/micrometer-observation-1.13.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.5.6/afc75d260d838a3bddfb8f207c2805ed7d1b34f9/logback-classic-1.5.6.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-to-slf4j/2.23.1/425ad1eb8a39904d2830e907a324e956fb456520/log4j-to-slf4j-2.23.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.slf4j/jul-to-slf4j/2.0.13/a3bcd9d9dd50c71ce69f06b1fd05e40fdeff6ba5/jul-to-slf4j-2.0.13.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jcl/6.1.8/a545266a6efac9283353a922783a0a06f197ec0/spring-jcl-6.1.8.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-commons/1.13.0/156a59aff8d72c5e631eb4a2d739373ed5881609/micrometer-commons-1.13.0.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.hdrhistogram/HdrHistogram/2.2.1/eb1feb351f64176c377772a30174e582c0274d5/HdrHistogram-2.2.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.latencyutils/LatencyUtils/2.0.3/769c0b82cb2421c8256300e907298a9410a2a3d3/LatencyUtils-2.0.3.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.prometheus/prometheus-metrics-model/1.2.1/99caac1a3f974de6bc9882fbf6a09ea055733c7b/prometheus-metrics-model-1.2.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.prometheus/prometheus-metrics-config/1.2.1/bcccb14176161671c4cb858b0ca50d680237fdbe/prometheus-metrics-config-1.2.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/io.prometheus/prometheus-metrics-shaded-protobuf/1.2.1/2b8ace486645dbaba1f3a694bd3a081f4d7a3aa5/prometheus-metrics-shaded-protobuf-1.2.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.17.1/969b0c3cb8c75d759e9a6c585c44c9b9f3a4f75/jackson-datatype-jsr310-2.17.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.module/jackson-module-parameter-names/2.17.1/74a998f6fbcedbddedf0a27e8ce72078b2e516a6/jackson-module-parameter-names-2.17.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.17.1/fca7ef6192c9ad05d07bc50da991bf937a84af3a/jackson-annotations-2.17.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.17.1/5e52a11644cd59a28ef79f02bddc2cc3bab45edb/jackson-core-2.17.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.17.1/76b495194c36058904c82e288d285a1bd13f0ffa/jackson-datatype-jdk8-2.17.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.17.1/524dcbcccdde7d45a679dfc333e4763feb09079/jackson-databind-2.17.1.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.24/938419aba5a4f4645b9cd23a9e1d5453e85d09b9/tomcat-embed-websocket-10.1.24.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.24/cd9358f0a26d26e1a2c7200f69cb9a302c20ceb4/tomcat-embed-core-10.1.24.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-el/10.1.24/6e9c9dce63c10f903cb0aaaeff45f5f7092f5527/tomcat-embed-el-10.1.24.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.5.6/41cbe874701200c5624c19e0ab50d1b88dfcc77d/logback-core-1.5.6.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/2.0.13/80229737f704b121a318bba5d5deacbcf395bc77/slf4j-api-2.0.13.jar:/Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.23.1/9c15c29c526d9c6783049c0a77722693c66706e1/log4j-api-2.23.1.jar:/Users/chaney/IdeaProjects/jfr-vth-pin/build/classes/java/aot:/Users/chaney/IdeaProjects/jfr-vth-pin/build/resources/aot:/Users/chaney/IdeaProjects/jfr-vth-pin/build/generated/aotClasses \
-imagemp \
/Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/graal-microservices.jar:/Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/library-support.jar \
-H:CLibraryPath=/Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/clibraries/darwin-amd64 \
-H:Path@driver=/Users/chaney/IdeaProjects/jfr-vth-pin/build/native/nativeCompile \
'-H:EnableURLProtocols@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/6.1.8/1461405dc325c82a0a058df033bee3d8c6dd6e41/spring-web-6.1.8.jar!/META-INF/native-image/org.springframework/spring-web/native-image.properties+api=http' \
'-H:EnableURLProtocols@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/6.1.8/1461405dc325c82a0a058df033bee3d8c6dd6e41/spring-web-6.1.8.jar!/META-INF/native-image/org.springframework/spring-web/native-image.properties+api=https' \
'-H:ClassInitialization@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/6.1.8/141fc11a5dbaa503fe361150312ad0fa9d9c03da/spring-core-6.1.8.jar!/META-INF/native-image/org.springframework/spring-core/native-image.properties+api=org.springframework.aot.nativex.feature.ThrowawayClassLoader:build_time' \
'-H:Features@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/6.1.8/141fc11a5dbaa503fe361150312ad0fa9d9c03da/spring-core-6.1.8.jar!/META-INF/native-image/org.springframework/spring-core/native-image.properties+api=org.springframework.aot.nativex.feature.PreComputeFieldFeature' \
'-H:ReflectionConfigurationResources@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-core/1.13.0/d7ed656fbc54fde5a03d978fc0d66f270cc4a997/micrometer-core-1.13.0.jar!/META-INF/native-image/io.micrometer/micrometer-core/reflect-config.json+api=META-INF/native-image/io.micrometer/micrometer-core/reflect-config.json' \
'-H:DynamicProxyConfigurationResources@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-core/1.13.0/d7ed656fbc54fde5a03d978fc0d66f270cc4a997/micrometer-core-1.13.0.jar!/META-INF/native-image/io.micrometer/micrometer-core/proxy-config.json+api=META-INF/native-image/io.micrometer/micrometer-core/proxy-config.json' \
'-H:ReflectionConfigurationResources@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.24/938419aba5a4f4645b9cd23a9e1d5453e85d09b9/tomcat-embed-websocket-10.1.24.jar!/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/native-image.properties=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/tomcat-reflection.json' \
'-H:ResourceConfigurationResources@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.24/938419aba5a4f4645b9cd23a9e1d5453e85d09b9/tomcat-embed-websocket-10.1.24.jar!/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/native-image.properties=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/tomcat-resource.json' \
'-H:ReflectionConfigurationResources@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.24/cd9358f0a26d26e1a2c7200f69cb9a302c20ceb4/tomcat-embed-core-10.1.24.jar!/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/native-image.properties=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-reflection.json' \
'-H:ResourceConfigurationResources@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.24/cd9358f0a26d26e1a2c7200f69cb9a302c20ceb4/tomcat-embed-core-10.1.24.jar!/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/native-image.properties=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-resource.json' \
'-H:ReflectionConfigurationResources@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-el/10.1.24/6e9c9dce63c10f903cb0aaaeff45f5f7092f5527/tomcat-embed-el-10.1.24.jar!/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/native-image.properties=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-reflection.json' \
'-H:ResourceConfigurationResources@jar:file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-el/10.1.24/6e9c9dce63c10f903cb0aaaeff45f5f7092f5527/tomcat-embed-el-10.1.24.jar!/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/native-image.properties=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-resource.json' \
-H:Class@file:///Users/chaney/IdeaProjects/jfr-vth-pin/build/resources/aot/META-INF/native-image/com.chaney/jfr-vth-pin/native-image.properties=com.chaney.jfrvthpin.JfrVthPinApplication \
-H:+ReportUnsupportedElementsAtRuntime@file:///Users/chaney/IdeaProjects/jfr-vth-pin/build/resources/aot/META-INF/native-image/com.chaney/jfr-vth-pin/native-image.properties+api \
-H:FallbackThreshold@file:///Users/chaney/IdeaProjects/jfr-vth-pin/build/resources/aot/META-INF/native-image/com.chaney/jfr-vth-pin/native-image.properties+api=0 \
-H:+InstallExitHandlers@file:///Users/chaney/IdeaProjects/jfr-vth-pin/build/resources/aot/META-INF/native-image/com.chaney/jfr-vth-pin/native-image.properties+api \
-H:ReflectionConfigurationResources@file:///Users/chaney/IdeaProjects/jfr-vth-pin/build/resources/aot/META-INF/native-image/com.chaney/jfr-vth-pin/reflect-config.json+api=META-INF/native-image/com.chaney/jfr-vth-pin/reflect-config.json \
-H:ResourceConfigurationResources@file:///Users/chaney/IdeaProjects/jfr-vth-pin/build/resources/aot/META-INF/native-image/com.chaney/jfr-vth-pin/resource-config.json+api=META-INF/native-image/com.chaney/jfr-vth-pin/resource-config.json \
-H:FallbackThreshold@user+api=0 \
-H:Name@user+api=jfr-vth-pin \
-H:ConfigurationFileDirectories@user=/Users/chaney/IdeaProjects/jfr-vth-pin/build/native/generated/generateResourcesConfigFile,/Users/chaney/.gradle/native-build-tools/repositories/6047974a0327b76e591762f7e920ae36e4a49ec4/exploded/ch.qos.logback/logback-classic/1.4.9,/Users/chaney/.gradle/native-build-tools/repositories/6047974a0327b76e591762f7e920ae36e4a49ec4/exploded/org.hdrhistogram/HdrHistogram/2.1.12,/Users/chaney/.gradle/native-build-tools/repositories/6047974a0327b76e591762f7e920ae36e4a49ec4/exploded/com.fasterxml.jackson.core/jackson-databind/2.15.2,/Users/chaney/.gradle/native-build-tools/repositories/6047974a0327b76e591762f7e920ae36e4a49ec4/exploded/org.apache.tomcat.embed/tomcat-embed-core/10.0.20 \
-H:EnableMonitoringFeatures@user+api=jfr \
-H:Optimize@user+api=0 \
-H:+DumpTargetInfo@user+api \
-H:ImageBuildID@driver=589ced71-e37e-70b7-6fea-4b5c92518037 \
'-H:Features@jar:file:///Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/library-support.jar!/META-INF/native-image/com.oracle.svm/thirdparty/native-image.properties+api=com.oracle.svm.thirdparty.gson.GsonFeature' \
'-H:Features@jar:file:///Users/chaney/.sdkman/candidates/java/21.0.2-graal/lib/svm/library-support.jar!/META-INF/native-image/com.oracle.svm/polyglot/native-image.properties+api=com.oracle.svm.polyglot.groovy.GroovyIndyInterfaceFeature,com.oracle.svm.polyglot.scala.ScalaFeature'
]
========================================================================================================================
GraalVM Native Image: Generating 'jfr-vth-pin' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing...                                                                                    (5.6s @ 0.22GB)
 Java version: 21.0.2+13-LTS, vendor version: Oracle GraalVM 21.0.2+13.1
 Graal compiler: optimization level: 0, target machine: x86-64-v3, PGO: off
 C compiler: cc (apple, x86_64, 14.0.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 2 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - org.springframework.aot.nativex.feature.PreComputeFieldFeature
------------------------------------------------------------------------------------------------------------------------
 2 experimental option(s) unlocked:
 - '-H:ResourceConfigurationResources' (origin(s): 'META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/native-image.properties' in 'file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.24/938419aba5a4f4645b9cd23a9e1d5453e85d09b9/tomcat-embed-websocket-10.1.24.jar', 'META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/native-image.properties' in 'file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.24/cd9358f0a26d26e1a2c7200f69cb9a302c20ceb4/tomcat-embed-core-10.1.24.jar', 'META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/native-image.properties' in 'file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-el/10.1.24/6e9c9dce63c10f903cb0aaaeff45f5f7092f5527/tomcat-embed-el-10.1.24.jar')
 - '-H:ReflectionConfigurationResources' (origin(s): 'META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/native-image.properties' in 'file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.24/938419aba5a4f4645b9cd23a9e1d5453e85d09b9/tomcat-embed-websocket-10.1.24.jar', 'META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/native-image.properties' in 'file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.24/cd9358f0a26d26e1a2c7200f69cb9a302c20ceb4/tomcat-embed-core-10.1.24.jar', 'META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/native-image.properties' in 'file:///Users/chaney/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-el/10.1.24/6e9c9dce63c10f903cb0aaaeff45f5f7092f5527/tomcat-embed-el-10.1.24.jar')
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 7.26GB of memory (22.7% of 32.00GB system memory, determined at start)
 - 12 thread(s) (100.0% of 12 available processor(s), determined at start)
# Printing compilation-target information to: /Users/chaney/IdeaProjects/jfr-vth-pin/build/native/nativeCompile/reports/target_info_20240527_220749.txt
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
# Printing native-library information to: /Users/chaney/IdeaProjects/jfr-vth-pin/build/native/nativeCompile/reports/native_library_info_20240527_220829.txt
[2/8] Performing analysis...  [******]                                                                  (40.9s @ 2.19GB)
   19,275 reachable types   (90.9% of   21,210 total)
   30,873 reachable fields  (68.2% of   45,248 total)
  102,937 reachable methods (64.0% of  160,935 total)
    6,380 types, 1,794 fields, and 8,476 methods registered for reflection
       62 types,    63 fields, and    55 methods registered for JNI access
        5 native libraries: -framework CoreServices, -framework Foundation, dl, pthread, z
[3/8] Building universe...                                                                               (5.5s @ 2.28GB)
[4/8] Parsing methods...      [***]                                                                      (5.9s @ 1.82GB)
[5/8] Inlining methods...     [**]                                                                       (0.6s @ 2.52GB)
[6/8] Compiling methods...    [*****]                                                                   (28.3s @ 3.53GB)
[7/8] Layouting methods...    [**]                                                                       (4.5s @ 3.17GB)
[8/8] Creating image...       [***]                                                                      (5.2s @ 2.91GB)
  30.50MB (45.55%) for code area:    90,226 compilation units
  36.02MB (53.78%) for image heap:  491,680 objects and 320 resources
 459.58kB ( 0.67%) for other data
  66.97MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 origins of code area:                                Top 10 object types in image heap:
  10.10MB java.base                                           10.81MB byte[] for code metadata
   3.14MB tomcat-embed-core-10.1.24.jar                        6.91MB byte[] for java.lang.String
   2.72MB svm.jar (Native Image)                               3.55MB java.lang.Class
   2.59MB java.xml                                             3.45MB java.lang.String
   1.39MB jackson-databind-2.17.1.jar                          1.40MB byte[] for reflection metadata
 957.06kB spring-core-6.1.8.jar                                1.39MB byte[] for embedded resources
 887.45kB prometheus-metrics-shaded-protobuf-1.2.1.jar       903.52kB com.oracle.svm.core.hub.DynamicHubCompanion
 857.89kB spring-boot-3.3.0.jar                              862.73kB byte[] for general heap data
 529.32kB jdk.jfr                                            556.44kB c.o.svm.core.hub.DynamicHub$ReflectionMetadata
 527.41kB jackson-core-2.17.1.jar                            475.83kB java.lang.String[]
   6.31MB for 104 more packages                                5.77MB for 4275 more object types
                              Use '-H:+BuildReport' to create a report with more details.
------------------------------------------------------------------------------------------------------------------------
Security report:
 - Binary includes Java deserialization.
 - Use '--enable-sbom' to embed a Software Bill of Materials (SBOM) in the binary.
------------------------------------------------------------------------------------------------------------------------
Recommendations:
 PGO:  Use Profile-Guided Optimizations ('--pgo') for improved throughput.
 INIT: Adopt '--strict-image-heap' to prepare for the next GraalVM release.
 HEAP: Set max heap for improved and more predictable memory usage.
 CPU:  Enable more CPU features with '-march=native' for improved performance.
 QBM:  Use the quick build mode ('-Ob') to speed up builds during development.
------------------------------------------------------------------------------------------------------------------------
                        9.1s (9.3% of total time) in 139 GCs | Peak RSS: 5.68GB | CPU load: 8.91
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /Users/chaney/IdeaProjects/jfr-vth-pin/build/native/nativeCompile/jfr-vth-pin (executable)
========================================================================================================================
Finished generating 'jfr-vth-pin' in 1m 37s.

Following the steps above, the first time to run curl --request POST --url 'http://localhost:8080/pinning will get the log as below:
jar-pin-log

but, when running as native-image, you get
native-no-pin-log
no pin log

@roberttoyonaga
Copy link
Collaborator

roberttoyonaga commented May 27, 2024

It looks like the root cause of this is that the thread is actually not getting pinned in Native Image. When I debug this, isPinned0 is negative and the thread will yield (while it doesn't in regular Java). I'm not 100% sure why there is a difference in vthread pinning behaviour between Native Image and Java, but perhaps its related to monitors always being inflated. In Java mode, the pin reason is MONITOR. Since stack locking does not exist as an optimization in NI, maybe vthreads don't need to pin while holding a monitor. Maybe @peter-hofer could explain more?

@peter-hofer
Copy link
Member

@roberttoyonaga Our implementation of monitors doesn't need to pin virtual threads. Pinning happens only with native code on the stack, while holding a monitor that was acquired via JNI's MonitorEnter function, or while executing a class initializer in a virtual thread.

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

No branches or pull requests

3 participants