jenkinsci / lib-file-leak-detector

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

Unable to run jar on Amazon JVM #155

Open spark85 opened 1 year ago

spark85 commented 1 year ago

Jenkins and plugins versions report

Environment ```text Paste the output here ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Mac Os Ventura 13.5.2, Java JVM Amazon Corretto 17 & 20. (Tried with multiple sub-releases)

Reproduction steps

1) Setup the Amazon Corretto JVM as java home and set it on your zsh path. 2) setup an Android gradle build (this is optional as it is unrelated to the bug. Just providing for context) 3) Use the jar command to start the listener. java -jar {path-to-jar}file-leak-detector-1.16-jar-with-dependencies.jar PID http=19999

Expected Results

Command should execute successfully

Actual Results

The command does not complete and returns with the following error

com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:170) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.kohsuke.file_leak_detector.Main.run(Main.java:74) at org.kohsuke.file_leak_detector.Main.main(Main.java:38)

Anything else?

We can only use Amazon Corretto, it seems many other JVM's work including Bell & SAP

Rodrigolmti commented 1 year ago

I was having this issue, and figure out that I was not using the latest version. Check if you are using the 1.13, the latest is 1.16