jenkinsci / lib-file-leak-detector

Java agent that detects file handle leak
http://file-leak-detector.kohsuke.org/
MIT License
241 stars 112 forks source link

java.lang.VerifyError: JVMVRFY012 stack shape inconsistent; class=java/net/AbstractPlainSocketImpl, #37

Open jsreedhar opened 6 years ago

jsreedhar commented 6 years ago

Hi,

I am trying to use the file leak detector jar in my application, when add the javaagent and start the jvm, getting the following error. I am using IBM JDK 7

File leak detector installed Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:405) at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:420) Caused by: java.lang.VerifyError: JVMVRFY012 stack shape inconsistent; class=java/net/AbstractPlainSocketImpl, method=create(Z)V, pc=6 at java.lang.J9VMInternals.verifyImpl(Native Method) at java.lang.J9VMInternals.verify(J9VMInternals.java:94) at java.lang.J9VMInternals.verify(J9VMInternals.java:92) at java.lang.J9VMInternals.initialize(J9VMInternals.java:169) at java.lang.Class.forNameImpl(Native Method) at java.lang.Class.forName(Class.java:256) at org.kohsuke.file_leak_detector.AgentMain.premain(AgentMain.java:130) ... 6 more

Fatal error: processing of -javaagent failed

when I pass the jvm argument -Xverify:none, then I get the following error

File leak detector installed Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:405) at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:420) Caused by: java.lang.ClassFormatError at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method) at sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:164) at org.kohsuke.file_leak_detector.AgentMain.premain(AgentMain.java:126) ... 6 more

Fatal error: processing of -javaagent failed

Please let me know how I can get pass this problem and bring up the jvm

Thanks, Sreedhar.

jsreedhar commented 6 years ago

Any updates?

mandragorn commented 4 years ago

I'm getting the same issue with adoptopen jdk 8:

openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
Eclipse OpenJ9 VM (build openj9-0.18.1, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20200122_511 (JIT enabled, AOT enabled)
OpenJ9   - 51a5857d2
OMR      - 7a1b0239a
JCL      - 8cf8a30581 based on jdk8u242-b08)
mandragorn commented 4 years ago

Based on this article: https://www.ibm.com/support/pages/ibm-java-linux-howto-resolving-javalangverifyerror-jvmvrfy012-stack-shape-inconsistent it looks like adding -Xverify:none to the java command line args works. An example from the pom to make the unit tests work:

-javaagent:"${project.build.directory}/${project.artifactId}-${project.version}-jar-with-dependencies.jar" -Xverify:none