Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can btrace implement hot swap? #346

Closed
chgitcrazy opened this issue Jun 6, 2018 · 7 comments
Closed

can btrace implement hot swap? #346

chgitcrazy opened this issue Jun 6, 2018 · 7 comments

Comments

@chgitcrazy
Copy link

chgitcrazy commented Jun 6, 2018

Today, I use btrace to debug my Application ,in the process ,I suddenly have an idea that if the btrace-agent.jar injected to the server could be unload ,then I wonldn't restart the server every time!
If so , I could use btrace to load and unload btrace-agent.jar to the process withouting restart it . It will be more convinient ! Is there any solution?

@jbachorik
Copy link
Collaborator

When using dynamic attach (btrace <pid> <trace script>) the instrumentation is removed once the session is closed. The agent remains in the JVM but it is basically just a socket listener for accepting new tracing sessions. With this approach you don't need to restart the server when you change the instrumentation.

If you attach the agent on startup (as JVM -javaagent argument) then this mode of operation is (almost) possible too. The only difference is that whatever script is loaded with the agent will stay there forever. But you still can attach and detach to the server JVM later on.

@chgitcrazy
Copy link
Author

Thank you !yeah ,I don't need to restart the server when I change the instrumentation. But if I want to change the function in the agent,is there any method?Such as adding a new Command;Because the Command function is loaded by bootclassloader,it's have no chance to be unload;The only method is restart the server!

@jbachorik
Copy link
Collaborator

Not really. This would require a fully-functional plugin system with plugin hotswap which is a pretty complicated thing to do. And considering the nature of the JVM agents this would be very susceptible to interference from the traced application - not even mentioning the unintended side effects such a complex agent might have on the traced application itself.

What it is you are trying to achieve?

@chgitcrazy
Copy link
Author

I want to achieve the function that could monitor and trace the Classes and Methods .
Besides,the function can be wrapper into a hotswap plugin to have no effect on the server(tomcat...) .Because I am afraid that the server would be affected by the code inused in the memory.

@jbachorik
Copy link
Collaborator

What about Adaptive Instrumentation - would that solve your problem?

@TJ2572208413
Copy link

i don't know

@github-actions
Copy link

Stale issue message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants