You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enabling JFR monitoring has side effects in Netty's initialization/configuration (and possibly in other libraries as well) that possibly skew the observed metrics.
#8020
Closed
zakkak opened this issue
Dec 14, 2023
· 5 comments
Describe the issue
When enabling JFR monitoring (--enable-monitoring=jfr) we observe that some constants in io.netty.util.internal.PlatformDependent and io.netty.util.internal.PlatformDependent0 are initialized to a different value.
Steps to reproduce the issue
cd /tmp
git clone --branch 2023-12-07-mandrel-it-tests-236 https://github.com/zakkak/issue-reproducers reproducer
cd reproducer
mvn package
java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image -jar target/reproducer-1.0-SNAPSHOT.jar
mvn package
native-image -jar target/reproducer-1.0-SNAPSHOT.jar
./reproducer-1.0-SNAPSHOT | tee no-jfr.txt
native-image -jar target/reproducer-1.0-SNAPSHOT.jar --enable-monitoring=jfr
./reproducer-1.0-SNAPSHOT | tee jfr.txt
diff no-jfr.txt jfr.txt
i.e. in one case Netty has access to the java.nio.DirectByteBuffer while in the other it doesn't, same for jdk.internal.misc.Unsafe, leading to different code paths' being taken when using JFR than when not. This might result in missleading observations when using JFR.
Describe GraalVM and your environment:
GraalVM version (latest snapshot builds can be found here), or commit id if built from source: dcbe8f4
It seems like opening jdk.jfr and java.base has no real impact. When I comment out the relevant code, all the native unittests still pass. Manual inspection of snapshots in JMC also shows no issues.
When I look at the git history com.oracle.svm.core.jfr.JfrFeature it seems like we've been opening jdk.jfr and java.base to the unnamed module since inception. Perhaps this is outdated legacy code and can be removed now. @christianhaeubl do you know if this is the case?
The only other thing I can think of is that this is necessary for using JFR at build time. I'll look into this more.
Describe the issue
When enabling JFR monitoring (
--enable-monitoring=jfr
) we observe that some constants inio.netty.util.internal.PlatformDependent
andio.netty.util.internal.PlatformDependent0
are initialized to a different value.Steps to reproduce the issue
This will result in a diff like the following:
Where the interesting parts are:
i.e. in one case Netty has access to the
java.nio.DirectByteBuffer
while in the other it doesn't, same forjdk.internal.misc.Unsafe
, leading to different code paths' being taken when using JFR than when not. This might result in missleading observations when using JFR.Describe GraalVM and your environment:
More details
Our so far understanding is that this is caused by the opening of
java.base/java.nio
to the unnamed module.According to @roberttoyonaga's expirement if we remove that particular line we no longer observe the issue.
FTR: This issue was first detected and studied in Karm/mandrel-integration-tests#236
cc @christianhaeubl @roberttoyonaga
The text was updated successfully, but these errors were encountered: