RFR: JDK-8325530: Vague error message when com.sun.tools.attach.VirtualMachine fails to load agent library [v2]
Alex Menkov
amenkov at openjdk.org
Wed Feb 21 21:42:08 UTC 2024
> VirtualMachine.loadAgentPath/loadAgentLibrary can fail with AgentLoadException in 2 cases:
> - attach listener returns error; in the case the exception is thrown from HotSpotVirtualMachine.processCompletionStatus (called from HotSpotVirtualMachine.execute);
> - attach listener returns success, but reply does not contain Agent_onAttach return code ("return code: %d" message).
>
> before jdk21 if attach listener fails to load required library, it returned error (case 1)
> from jdk21 attach listener always returns success (case 2)
> Both cases are ok, but for 2nd case HotSpotVirtualMachine.loadAgentLibrary read only single line of the response message, so exception message didn't contain error details.
>
> The fix updates HotSpotVirtualMachine.loadAgentLibrary to read the whole response message.
> Walking through the code, fixed some other minor things in attach listener and attach API implementation (commented in the code)
>
> Testing:
> - test/jdk/com/sun/tools;
> - tier1,tier2,tier5-svc
Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
uncaught error
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/17954/files
- new: https://git.openjdk.org/jdk/pull/17954/files/19f0822e..0304bae2
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=17954&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=17954&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/17954.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/17954/head:pull/17954
PR: https://git.openjdk.org/jdk/pull/17954
More information about the core-libs-dev
mailing list