-
Notifications
You must be signed in to change notification settings - Fork 98
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
OpenJDK 13 requires -XX:+AllowRedefinitionToAddDeleteMethods flag #33
Comments
I'm afraid that's due to https://bugs.openjdk.java.net/browse/JDK-8192936 and similar to #21 We will need to find an alternative way for 13+ and J9, meanwhile, they seem to plan adding a flag to keep the behaviour for a few versions: |
@bsideup When I use |
@juergenzimmermann thanks a lot for trying it! |
Heaving quite different behavior on Oracle JDK 13 in Windows: it does not throw an error about blocking call until I add this flag |
Since OpenJDK requires `-XX:+AllowRedefinitionToAddDeleteMethod` (see #33) starting with Java 13, we should test that the instrumentation was applied correctly and fail fast if not.
Since OpenJDK requires `-XX:+AllowRedefinitionToAddDeleteMethod` (see #33) starting with Java 13, we should test that the instrumentation was applied correctly and fail fast if not.
Still reproduced with JDK 14.0.1 and BlockHound 1.0.3 |
Using Blockhound 1.0.4 and JDK 14.0.2 and specify the following in surefire plugin worked:
|
any way this can be added to gradle? |
@abdullahumer sure: tasks.withType(Test).all {
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_13)) {
jvmArgs += [
"-XX:+AllowRedefinitionToAddDeleteMethods"
]
}
} |
Thanks! @bsideup |
Removed due to issues with OpenJDK version 13+ reactor/BlockHound#33
Still reproduced with JDK 15.0.2 and BlockHound 1.0.6.RELEASE. |
The dependency is not needed anymore and there is a issue when using OpenJDK 13 or higher reactor/BlockHound#33 Issue spring-projectsgh-10343
The dependency is not needed anymore and there is a issue when using OpenJDK 13 or higher reactor/BlockHound#33 Issue spring-projectsgh-10343
The dependency is not needed anymore and there is a issue when using OpenJDK 13 or higher reactor/BlockHound#33 Issue gh-10343
The dependency is not needed anymore and there is a issue when using OpenJDK 13 or higher reactor/BlockHound#33 Issue gh-10343
The dependency is not needed anymore and there is a issue when using OpenJDK 13 or higher reactor/BlockHound#33 Issue spring-projectsgh-10343
Prior to this commit, our BlockHound integration tests were disabled after the migration to a JDK 17 baseline since the build now always runs on JDK 14 or higher. To re-enable the tests we now supply the deprecated -XX:+AllowRedefinitionToAddDeleteMethods command-line argument to the JVM for tests in the Gradle build. Users can also configure this manually within an IDE to run SpringCoreBlockHoundIntegrationTests. If that command-line argument is removed from the JVM at some point in the future, we will need to investigate an alternative solution. See reactor/BlockHound#33 for details.
In my case Using Blockhound 1.0.6 and JDK 15.0.6, worked |
Using blockhound 1.0.6 and JDK 16.0.2 I am still getting this error and has to use the flag... |
Hi. As far as I understand, according to https://bugs.openjdk.org/browse/JDK-8221528. "This option (AllowRedefinitionToAddOrDeleteMethods) is deprecated right away. The plan is to keep it for a couple of releases to allow customers (tool vendors) to remove dependency on old behavior from their tools." Do you plan BlockHound work according to the new JVM TI behavior? |
I guess that if this issue is not solved, when the option |
Now in 2023, almost four years after the original issue, would it be possible to have a fix without the -XX workaround please? |
I will take a look, but I don't promise anything for the moment, because looking at the history of this issue, without the work around flag, it seems to be a very very big deal to redefine / retransform classes (add/delete private static and private final instance methods in the new class versions). thanks. |
i am using Java 17 and Spring 3.1.3, even after including the |
Hi @divyanshsaini1805 , please open a separate issue with a reproducer project; build.gradle:
DemoApplication.java:
Demo.java:
then, from one console using java17:
from another console:
this will display the following from the first console:
Thanks. |
I have tried on windows with corretto-17 and temurin-17. When I add the vm option to the Surefire plugin config in pom.xml, my unit tests work with BlockHound. But when I add the vm option to my IntelliJ run configuration or in the vm options file I still see this error when I start up my springboot app:
I see this: Any ideas? Thanks. |
hi, i know it's been a super long time, but since this thread is a lot active, i would like to add my part, |
using Blockhound with JDK 22 is not working, even when using "-XX:+AllowRedefinitionToAddDeleteMethods" option: Caused by: java.lang.IllegalStateException: The instrumentation have failed. It looks like you're running on JDK 13+. You need to add '-XX:+AllowRedefinitionToAddDeleteMethods' JVM flag. See #33 for more info. at reactor.blockhound.BlockHound$Builder.testInstrumentation(BlockHound.java:538) at reactor.blockhound.BlockHound$Builder.install(BlockHound.java:501) at reactor.blockhound.BlockHound.install(BlockHound.java:91) at reactor.blockhound.junit.platform.BlockHoundTestExecutionListener.<clinit>(BlockHoundTestExecutionListener.java:19) ... 39 more this is because during initialization, Blockhound is trying to instrument the Thread.sleep() method, and if it does not work, then the initialization fails and assumes that the failure comes from a missing "-XX:+AllowRedefinitionToAddDeleteMethods" option. but, here the problem is that in JDK 22, the internal native method called by Thread.sleep has changed, it's "Thread.sleepNanos0" instead of "Thread.sleep0". This PR corrects the instrumentation for Thread.sleepNanos0 native method when the JDK version is detected to be 22+ Fixes #404
) * Bump org.apache.maven.plugins:maven-gpg-plugin from 3.1.0 to 3.2.2 Bumps [org.apache.maven.plugins:maven-gpg-plugin](https://github.com/apache/maven-gpg-plugin) from 3.1.0 to 3.2.2. - [Release notes](https://github.com/apache/maven-gpg-plugin/releases) - [Commits](apache/maven-gpg-plugin@maven-gpg-plugin-3.1.0...maven-gpg-plugin-3.2.2) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-gpg-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * work around for issue reactor/BlockHound#33 --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: cprutle <[email protected]>
OpenJDK 12.0.1 with even Kotlin 1.3.40-eap-67 works fine. However, using OpenJDK 13 build 23 I get the following exception:
The text was updated successfully, but these errors were encountered: