Skip to content

Commit

Permalink
Add -Xverify:none to tests and docs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jyoung committed Apr 18, 2020
1 parent 540cd9c commit 6d05a4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<exclude>**/TransformerTest.java</exclude>
</excludes>
<argLine>
-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
</argLine>
</configuration>
</execution>
Expand Down
14 changes: 10 additions & 4 deletions src/site/apt/index.apt
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,34 @@ 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
and upon "too many open files" exception, the table will be dumped to
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.
Expand All @@ -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
-------------

0 comments on commit 6d05a4d

Please sign in to comment.