From 6d05a4d478d0cd917f828fac269b93f3978277da Mon Sep 17 00:00:00 2001 From: jyoung Date: Fri, 17 Apr 2020 22:29:59 -0400 Subject: [PATCH] Add -Xverify:none to tests and docs On newer versions of java bytecode is verified before it is run. Since this agent modifies core java bytecode it needs to bypass this verification. To turn the verification off pass -Xverify:none as an argument when running the agent. Fixed in unit tests and docs. Details: https://www.ibm.com/support/pages/ibm-java-linux-howto-resolving-javalangverifyerror-jvmvrfy012-stack-shape-inconsistent --- pom.xml | 2 +- src/site/apt/index.apt | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 1ada60c..86298ea 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ **/TransformerTest.java - -javaagent:"${project.build.directory}/file-leak-detector-${project.version}-jar-with-dependencies.jar" + -javaagent:"${project.build.directory}/file-leak-detector-${project.version}-jar-with-dependencies.jar" -Xverify:none diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt index 4583d97..2fda18e 100644 --- a/src/site/apt/index.apt +++ b/src/site/apt/index.apt @@ -14,6 +14,12 @@ What is this? dependency jar and the list of the table can be {{{http://file-leak-detector.kohsuke.org/apidocs/index.html?org/kohsuke/file_leak_detector/Listener.html}programmatically accessed}}. +Warning + + The agent modifies the bytecode of core java classes, which causes java bytecode + validation to fail ({{{https://www.ibm.com/support/pages/ibm-java-linux-howto-resolving-javalangverifyerror-jvmvrfy012-stack-shape-inconsistent}details}}). For it to work in newer version + of java you need the include the -Xverify:none flag when running the javaagent. + Usage Without any option, this tool silently records file open/close operations @@ -21,21 +27,21 @@ Usage stderr. ------------- -$ java -javaagent:path/to/file-leak-detector.jar ...your usual Java args follows... +$ java -javaagent:path/to/file-leak-detector.jar -Xverify:none ...your usual Java args follows... ------------- There are several options you can pass to the agent. For example, to dump the open file handles when the total number reaches 200, you can do the following: ------------- -$ java -javaagent:path/to/file-leak-detector.jar=threshold=200 ...your usual Java args follows... +$ java -javaagent:path/to/file-leak-detector.jar=threshold=200 -Xverify:none ...your usual Java args follows... ------------- Or have it run a mini HTTP server so that you can access the information from your browser, do the followind and open http://localhost:19999/: ------------- -$ java -javaagent:path/to/file-leak-detector.jar=http=19999 ...your usual Java args follows... +$ java -javaagent:path/to/file-leak-detector.jar=http=19999 -Xverify:none ...your usual Java args follows... ------------- Use the help option to see the help screen for the complete list of options. @@ -52,5 +58,5 @@ Attaching after VM startup in the same format you do to the agent. ------------- -$ java -jar path/to/file-leak-detector.jar 1500 threshold=200,strong +$ java -jar path/to/file-leak-detector.jar 1500 threshold=200,strong -Xverify:none -------------