-
Notifications
You must be signed in to change notification settings - Fork 707
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
JVM_EnqueueOperation() stubbed #3441
Comments
See also #3442 for a similar dump on macOS - but with a different exception |
@ChengJin01 Can you look at this? |
Will investigate to see what happened in there. |
I don't think the issue here has anything to do with #3442 as JVM_SocketShutdown() was already implemented on UNIX-based system (So it just got enabled for OSX). JVM_EnqueueOperation() was not implemented on any platform. So I need to figure out how this got invoked on Windows first. |
It seems something is trying to use the OpenJDK/Hotspot attach mechanism instead of the OpenJ9 one. i.e. it must be hard coded to use sun.tools.attach.WindowsVirtualMachine (or similar concrete class) instead of using the generic api classes as it should. |
I already noticed that at openj9-openjdk-jdk8/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c.
If so, it looks like there are some setting to be modified so as to avoid sun.tools.attach.WindowsVirtualMachine in favor of our build. |
@planetf1, I already installed maven 3.5.4 and IntelliJ IDEA on Windows 10 but failed to compile after building with "mvn clean install" on the imported egeria project, which I suspect some setting went wrong before compilation. Could you provide the specific steps on how to reproduce the assertion? |
Note the OpenJ9 build is configured correctly, I think this problem would only occur if something is hard coded to refer to the Hotspot attach api implementation rather than the generic api classes https://docs.oracle.com/javase/8/docs/jdk/api/attach/spec/index.html |
That should come from the application level. But I didn't find anything related to sun_tools_attach_WindowsVirtualMachine in https://github.com/odpi/egeria. Probably it was triggered from some loading plugins/packages. |
For reference, here is the configuration that selects the OpenJ9 attach api implementation for the generic api. jdk11: |
try looking for sun.tools.attach.AttachProviderImpl (jdk11) instead |
or sun.tools.attach.WindowsAttachProvider (jdk8) |
I just found WindowsVirtualMachine comes from lib/tools.jar in jdk8u192-b12 /cygdrive/c/temp_jdk8/jdk8u192-b12/lib/tools/sun/tools/attach (extracted from lib/tools.jar) |
Right, the files are there, but not used by the api classes because of the settings in #3441 (comment) . These classes would only be used if referenced directly by some code. |
The only way to prove that is to reproduce locally to see what happens on the backtraces; otherwise, I suspect the setting at openj9-openjdk-jdk8 might go wrong in forwarding to the correct OpenJ9 class (/jcl/src/jdk.attach/share/classes/com/ibm/tools/attach/attacher/OpenJ9VirtualMachine) |
After adjusting the setting with maven, I managed to trigger the same assertion failures as follows:
javacore.20181101.142234.25064.0002.txt Looking at the code at /runtime/j9vm/j7vmi.c
It looks like it has nothing to do with AttachProvider/VirtualMachine at this point. (any connection with ClassLoader ?) |
Looking at the command line option: I suspect JVM_DefineClassWithSourceCond was invoked via Instrumentation from IntelliJ IDEA. So I double-check the directory at IntelliJ IDEA: /cygdrive/c/JetBrains/IntelliJ IDEA 183.4139.22 /cygdrive/c/JetBrains/IntelliJ IDEA 183.4139.22 Dump file jvm.dll (via dumpbin.exe)
With the backtrace above, it seems the calling path is : JVM_DefineClassWithSourceCond(IntelliJ) -> JVM_EnqueueOperation(IntelliJ) --> JVM_EnqueueOperation(OpenJ9) |
I suspect the native stack is wrong in showing JVM_DefineClassWithSourceCond. There is a second process involved which is causing the JVM_EnqueueOperation in this VM. This other process is using sun.tools.attach.WindowsVirtualMachine instead of the OpenJ9 attach api. |
If the only JVMs involved are OpenJ9, you can use the IBM_JAVA_OPTIONS environment variable to set -Xdump options to create a javacore when the sun.tools.attach.WindowsVirtualMachine code is called. |
Make that an -Xdump option when the sun.tools.attach.WindowsVirtualMachine class is loaded, which is probably good enough, or an -Xtrace option when specific code is called. |
From the console in IntelliJ IDEA, it seems there is only one JVM getting started to build egeria
I am not too sure whether a second process exists in the background. Probably need to compile a build to halt in JVM_EnqueueOperation() to see what happens. |
Well if you set |
Also, if you delete |
It seems IBM_JAVA_OPTIONS didn't get added to the command line (need to double-check the setting in maven and IntelliJ IDEA) |
I double-checked the steps:
Given that jre64/bin/attach.dll in IntelliJ IDEA is related to sun.tools.attach.WindowsVirtualMachine, I suspect a second process did exist but exit right after the assert failure occurred (just noticed that on the Task Manager) |
Already added it to the maven setting but no java core was generated. Other interesting findings:
So I suspect the problem has nothing to do with this project but with any maven-based project which has to be built via the "Execute Maven Goal" button. I am not sure how this button works in IntelliJ IDEA but I suspect it first launched a JVM process (assert failure occurred in this process) which creates another JVM process to build the maven project. That explains why the maven project keeps being built even though the assert failure occurs. |
You could try removing the OpenJDK/Hotspot attach api classes like sun.tools.attach.WindowsVirtualMachine and see if this changes the behavior. Also check if there is a log file where errors/exceptions get logged. |
and you can go ahead and create a PR to do #3441 (comment) |
I already created a PR at ibmruntimes/openj9-openjdk-jdk8#202 to exclude WindowsVirtualMachine related classes (attach.dll never generated during compilation). The assertion failure still occurred with the compiled build in IntelliJ.
The result confirms that JVM_EnqueueOperation was not invoked from JDK8/OpenJ9. |
@pshipton, I looked over the issue you previously detected/closed at #2275 and I believe this is the exactly same problem as what we had here. It already explained what happened to the native stack:
which is the same result we encountered in IntelliJ. So the backtrace collected previously was correct that the invocation of JVM_EnqueueOperation came from IntelliJ. To verify the workaround suggested at #2275, I replaced jre64/lib/tools.jar in IntelliJ with tools.jar in our jdk8/openj9 build and it works good without the assertion failure box. So there is nothing more we can do on our side at this point. We can still remove the attach api classes with WindowsVirtualMachine via ibmruntimes/openj9-openjdk-jdk8#202 if you agree even though it has nothing to do with this issue. |
@ChengJin01 I think we should still proceed with ibmruntimes/openj9-openjdk-jdk8#202 |
Will verify the changes with WindowsVirtualMachine at ibmruntimes/openj9-openjdk-jdk8#202 after updating. In addition, this issue here should be marked as duplicate with #2275 |
Similarly to #2275, we should contact IntelliJ and ask they include the OpenJ9 tools.jar in addition to the Hotspot version, and use the appropriate tools.jar that matches the JVM. |
Request has been created at https://intellij-support.jetbrains.com/hc/en-us/requests/1864909 to track the issue. |
The request was reported to https://youtrack.jetbrains.com/issue/JRE-1037 |
I think I have found another way to reproduce the same issue. Please check simple 1 class maven project It fails with exactly the same error message. I use power If I just remove attach.dll, I face (expected actually)
My env.
Does it mean that power mockito depends on hotspot version and will not work with J9? |
Apparently it was still using sun.tools.attach.WindowsVirtualMachine (sun.tools.attach.WindowsVirtualMachine.class is specific to Hotspot. The enqueue() native is calling JVM_EnqueueOperation().) instead of com.ibm.tools.attach.attacher.OpenJ9VirtualMachine. That's why it triggered the same assertion failure.
It looks like this is another issue. Need to figure out why it happens in this way. |
Let me know if you want me to open separate issue |
@kgrechishchev , please show me the steps (what else needs to be installed) to reproduce the issue because didn't see any assertion failure when running "mvn test" except building failure.
|
I double-checked the source code at https://github.com/powermock/powermock as follows:
It turns out the code there bundles WindowsVirtualMachine to trigger JVM_EnqueueOperation eventually by using reflection on WindowsVirtualMachine, which can't be prevented on our side as OpenJ9 still includes WindowsVirtualMachine without any use for now. Thus, it will throw out an RuntimeException once WindowsVirtualMachine is removed via ibmruntimes/openj9-openjdk-jdk8#202. To get their code work on OpenJ9, they need to update getVirtualMachineImplementationFromEmbeddedOnes() to support OpenJ9VirtualMachine in addition to WindowsVirtualMachine. |
The change is to remove these api classes and stop them from generating attach.dll and bytecode on Windows as these classes are replaced with the implementation in OpenJ9. Related to eclipse-openj9/openj9#3441 Signed-off-by: CHENGJin <jincheng@ca.ibm.com>
The test change is to replace the attach library with another native library as attach library has been removed. Related to eclipse-openj9#3441 Signed-off-by: CHENGJin <jincheng@ca.ibm.com>
@ChengJin01 @DanHeidinga I have tested it with the latest versions of powerkmock and J9. I have logged an issue on powermock/powermock#970 You can see how it looks now, it basically prints |
I can confirm that when using IntelliJ (latest EAP) with the latest J9 Java 8 JVM, I no longer see this issue and build/compile works normally. Thanks! |
When trying to build github.com/odpi/egeria with 'mvn clean install' using maven 3.5.4 on windows 10, within IntelliJ IDEA, I get:
Microsoft Visual C++ Runtime Library
X Assertion failed!
Program: c:\java\jdku192-b12\bin\java.exe
File: j7vmi.c
Line: 2713
Expression: !"JVM_EnqueueOperation() stubbed!"
The JDK was downloaded from adoptopenjdk.net
I can ignore the popup, and the process does continue
A similar issue occurs on MacOS, but the exception is different:
The text was updated successfully, but these errors were encountered: