RFR: JDK-8325530: Vague error message when com.sun.tools.attach.VirtualMachine fails to load agent library [v3]
Alex Menkov
amenkov at openjdk.org
Thu Feb 22 23:27:54 UTC 2024
On Thu, 22 Feb 2024 22:27:04 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
> In invoke_Agent_OnAttach(), I think the second print_cr() should start with a space:
>
> ```
> st->print_cr("%s was not loaded.", agent->name());
> if (*ebuf != '\0') {
> st->print_cr("%s", &ebuf[0]);
> }
> return false;
> ```
>
> Otherwise in the output you see the reason for the failure start right after the period:
>
> `com.sun.tools.attach.AgentLoadException: Failed to load agent library: FailedLoadAgentTestNotExists was not loaded.libFailedLoadAgentTestNotExists.so: cannot open shared object file: No such file or directory`
It may be other messages in the outputStream (like "Dynamic agent loading is not enabled.")
So I think it should be fixed in HotSpotVirtualMachine.readErrorMessage (it converts multi-line message to single string) by replacing CRs with spaces.
>
> Also, ebuf is of size 1024 and is getting truncated sometimes. See your macosx log files on mdash. This doesn't necessarily have to be fixed, but something to consider.
I'll file a separate issue for this.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17954#issuecomment-1960504459
More information about the serviceability-dev
mailing list