-
Notifications
You must be signed in to change notification settings - Fork 132
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
Fix "URI is not hierarchical" during runtime attachment #359
Conversation
…ing runtime attachment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way to know whether copying is needed, and only copy in that case?
try { | ||
ByteBuddyAgent.attach(javaagentFile, getPid()); | ||
} finally { | ||
agentFileProvider.deleteTempDir(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think that the JVM would still need access to the jar file for lazy loading additional classes? (in which case we could delete on exit instead)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure because the Javadoc of Byte Buddy's attach(File agentJar, String processId)
method says "This operation blocks until the attachment is complete". In case of doubt, I will delete in exit.
The problem has appeared when the application was packaged as a jar file (I expect the same problem with a war file). The only solution I have found is to use a temp jar file (I have tried to write code with real path but without success). The same thing is done in Elastic agent. We could use a
|
makes sense, we may want to revisit later due to users on read-only file systems, but I agree with keeping it simple for now |
We may use the |
} | ||
|
||
private static void deleteTempDirOnJvmExit(Path tempDirPath, Path tempAgentJarPath) { | ||
if (tempDirPath != null && tempAgentJarPath != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can these be null
? if so, let's add @Nullable
to the params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be null but i was afraid by build checks 😅
I pushed spotlessApply 👍 |
Thank you! Maybe it would be possible to automatically add a spotless:apply commit in the CI |
When the runtime attachment feature was used with a Spring Boot application (jar), the runtime attachement dit not work and the following stack trace appeared:
This PR fixes the issue.