Improve diagnostics/troubleshooting features for agent installation
sbailliez opened this issue · 1 comments
It might be useful to have some better diagnostic features to help troubleshoot the agent misbehaving during the attachment process.
- Document the property
net.bytebuddy.agent.attacher.dump
and if the agent fails, provide some recommendations to use it if it is not enabled already. - Log the command line created by ByteBuddyAgent to attach to the vm in the log dump file. Right now it is opaque and you have to debug to know what process command line gets executed
- Provide the ability to pass extra jvm arguments to the command line to help debugging/troubleshooting (probably some security elements to consider here)
- Capture the output of the process and report in the dump file in case of failure
Additional idea to consider, when debugging an agent issue with mockito, I found that the openjdk jvm checks that the .attach_pid<pid>
file created has the same uid that the current user and does not attach if they are different, it would be nice to provide a check to help guide the user when such case is detected and make this part of bytebuddy. See mockito/mockito#2436 (comment) for more details.
I agree with (1) and already added the property to the exception. (4) should come implicit with that as Byte Buddy controls the output within the Attacher
main method. I do however not want to offer (2) and (3) for security reasons, this can be debugged differently, I think. When knowing the code, a user can explicitly log the passed statements in a more secure manner, for example. byte-buddy-agent is small enough so that everybody should be able to click through.