Coder Social home page Coder Social logo

Java 22 Support about blockhound HOT 11 CLOSED

dwarakaprasad avatar dwarakaprasad commented on June 11, 2024
Java 22 Support

from blockhound.

Comments (11)

pderop avatar pderop commented on June 11, 2024 1

Hi @dwarakaprasad ,

I also reproduced the issue, I'm trying to figure out.
Have uploaded a reproducer sample in raphw/byte-buddy#1609, let's see if Rafael can help on this.

thanks.

from blockhound.

pderop avatar pderop commented on June 11, 2024 1

@dwarakaprasad ,

Actually, there was a problem in BlockHound because in JDK22, the Thred.sleep() method is now internally calling Thread.sleepNanos0 instead of Thread.sleep0 native method.

The PR #407 for this problem has been merged and has been pushed to the snapshot repo.
Can you try again the 1.0.9.BUILD-SNAPSHOT version available from https://repo.spring.io/snapshot ?

thanks.

from blockhound.

pderop avatar pderop commented on June 11, 2024

@dwarakaprasad ,

Can you test with the snapshot version 1.0.9.BUILD-SNAPSHOT of BlockHound that is available from https://repo.spring.io/snapshot ?

the snapshot is now using the latest byte buddy version.
can you please confirm ? if it works, then let's release 1.0.9 version (but before, I will need to check #403).

thanks

from blockhound.

dwarakaprasad avatar dwarakaprasad commented on June 11, 2024

@dwarakaprasad ,

Can you test with the snapshot version 1.0.9.BUILD-SNAPSHOT of BlockHound that is available from https://repo.spring.io/snapshot ?

the snapshot is now using the latest byte buddy version. can you please confirm ? if it works, then let's release 1.0.9 version (but before, I will need to check #403).

thanks

Awesome, yup will do...
thank you!

from blockhound.

dwarakaprasad avatar dwarakaprasad commented on June 11, 2024

the above error doesn't happen, but getting the instrumentation error...

VM arg - -XX:+AllowRedefinitionToAddDeleteMethods is set as part of the Surefire plugin configuration. I tried running the test in eclipse and debugged the incoming VM args and found the above arg.

[-Xmx3489m, -XX:+ShowCodeDetailsInExceptionMessages, -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:40797, -ea, -XX:+AllowRedefinitionToAddDeleteMethods, -XX:+EnableDynamicAgentLoading, -Dspring.profiles.active=testprod, -Ddamo=damo, -javaagent:/workspace/eclipse/configuration/org.eclipse.osgi/414/0/.cp/lib/javaagent-shaded.jar, -Dfile.encoding=UTF-8]

Couldn't find anything related to the argument in JDK 22 docs (on the surface...). Before I go any further, wanted to validate my findings.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.2.5:test (default-test) on project jup: 
[ERROR] 
[ERROR] Please refer to /workspace/code/jup/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] There was an error in the forked process
[ERROR] java.util.ServiceConfigurationError: org.junit.platform.launcher.TestExecutionListener: Provider reactor.blockhound.junit.platform.BlockHoundTestExecutionListener could not be instantiated
[ERROR] org.apache.maven.surefire.api.util.SurefireReflectionException: java.util.ServiceConfigurationError: org.junit.platform.launcher.TestExecutionListener: Provider reactor.blockhound.junit.platform.BlockHoundTestExecutionListener could not be instantiated
[ERROR]         at org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:129)
[ERROR]         at org.apache.maven.surefire.api.util.ReflectionUtils.invokeGetter(ReflectionUtils.java:62)
[ERROR]         at org.apache.maven.surefire.junitplatform.LazyLauncher.launcher(LazyLauncher.java:68)
[ERROR]         at org.apache.maven.surefire.junitplatform.LazyLauncher.discover(LazyLauncher.java:50)
[ERROR]         at org.apache.maven.surefire.junitplatform.TestPlanScannerFilter.accept(TestPlanScannerFilter.java:52)
[ERROR]         at org.apache.maven.surefire.api.util.DefaultScanResult.applyFilter(DefaultScanResult.java:87)
[ERROR]         at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.scanClasspath(JUnitPlatformProvider.java:142)
[ERROR]         at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
[ERROR]         at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
[ERROR]         at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
[ERROR]         at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
[ERROR]         at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
[ERROR] Caused by: java.util.ServiceConfigurationError: org.junit.platform.launcher.TestExecutionListener: Provider reactor.blockhound.junit.platform.BlockHoundTestExecutionListener could not be instantiated
[ERROR]         at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:582)
[ERROR]         at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:809)
[ERROR]         at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:725)
[ERROR]         at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1397)
[ERROR]         at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
[ERROR]         at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
[ERROR]         at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:556)
[ERROR]         at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:546)
[ERROR]         at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
[ERROR]         at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
[ERROR]         at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
[ERROR]         at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:611)
[ERROR]         at org.junit.platform.launcher.core.LauncherFactory.registerTestExecutionListeners(LauncherFactory.java:195)
[ERROR]         at org.junit.platform.launcher.core.LauncherFactory.createDefaultLauncher(LauncherFactory.java:142)
[ERROR]         at org.junit.platform.launcher.core.LauncherFactory.lambda$openSession$1(LauncherFactory.java:101)
[ERROR]         at org.junit.platform.launcher.core.DefaultLauncherSession.<init>(DefaultLauncherSession.java:53)
[ERROR]         at org.junit.platform.launcher.core.LauncherFactory.openSession(LauncherFactory.java:100)
[ERROR]         at org.junit.platform.launcher.core.LauncherFactory.openSession(LauncherFactory.java:82)
[ERROR]         at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[ERROR]         at org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:125)
[ERROR]         ... 11 more
[ERROR] Caused by: java.lang.ExceptionInInitializerError
[ERROR]         at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
[ERROR]         at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unknown Source)
[ERROR]         at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:340)
[ERROR]         at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newConstructorAccessor(MethodHandleAccessorFactory.java:103)
[ERROR]         at java.base/jdk.internal.reflect.ReflectionFactory.newConstructorAccessor(ReflectionFactory.java:173)
[ERROR]         at java.base/java.lang.reflect.Constructor.acquireConstructorAccessor(Constructor.java:549)
[ERROR]         at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
[ERROR]         at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
[ERROR]         at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:785)
[ERROR]         ... 30 more
[ERROR] Caused by: java.lang.IllegalStateException: The instrumentation have failed.
[ERROR] It looks like you're running on JDK 13+.
[ERROR] You need to add '-XX:+AllowRedefinitionToAddDeleteMethods' JVM flag.
[ERROR] See https://github.com/reactor/BlockHound/issues/33 for more info.
[ERROR]         at reactor.blockhound.BlockHound$Builder.testInstrumentation(BlockHound.java:538)
[ERROR]         at reactor.blockhound.BlockHound$Builder.install(BlockHound.java:501)
[ERROR]         at reactor.blockhound.BlockHound.install(BlockHound.java:91)
[ERROR]         at reactor.blockhound.junit.platform.BlockHoundTestExecutionListener.<clinit>(BlockHoundTestExecutionListener.java:19)
[ERROR]         ... 39 more

from blockhound.

pderop avatar pderop commented on June 11, 2024

based on discussions from raphw/byte-buddy#1609 (comment), it's likely that there is a bug in OpenJDK 22 around the AllowRedefinitionToAddDeleteMethodsoption allowing to redefine native methods.

I will first isolate the problem in a reproducer sample code outside of BlockHound and will submit it to OpenJDK for version 22.
And for the long term, another way to instrument native methods should be investigated in order to not depend on the AllowRedefinitionToAddDeleteMethodsoption anymore.

for the moment, I'm attaching here a reproducer based on BlockHound here:
blockhound-issue-410.tgz

(see raphw/byte-buddy#1609 (comment) on how to run the blockhound-issue-410.tgz reproducer test).

I'm now working on doing a standalone reproducer sample code in order to submit it to OpenJDK 22.

from blockhound.

dwarakaprasad avatar dwarakaprasad commented on June 11, 2024

@dwarakaprasad ,

Actually, there was a problem in BlockHound because in JDK22, the Thred.sleep() method is now internally calling Thread.sleepNanos0 instead of Thread.sleep0 native method.

The PR #407 for this problem has been merged and has been pushed to the snapshot repo. Can you try again the 1.0.9.BUILD-SNAPSHOT version available from https://repo.spring.io/snapshot ?

thanks.

Yeah sure, will keep you posted.

from blockhound.

pderop avatar pderop commented on June 11, 2024

Hi @dwarakaprasad,

We may release BlockHound this week; but I just wonder if you had a chance to validate the 1.0.9.BUILD-SNAPSHOT version which has the fix for jdk22 support ?

thanks.

from blockhound.

dwarakaprasad avatar dwarakaprasad commented on June 11, 2024

We may release BlockHound this week; but I just wonder if you had a chance to validate the 1.0.9.BUILD-SNAPSHOT version which has the fix for jdk22 support ?

Hi @pderop, Sorry for the delayed reply. I was able to add your changes to my project and was able to successful move past the issue. Thank you so much.

from blockhound.

pderop avatar pderop commented on June 11, 2024

thanks a lot for having verified the PR, then let's release all this 🚀

from blockhound.

pderop avatar pderop commented on June 11, 2024

The BlockHound 1.0.9.RELEASE version has been released and includes the fix.

from blockhound.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.