Skip to content

Commit 05dc85e

Browse files
Instana attachpid file removal handling (#1884)
* Fix stale .attach_pid files left in cwd if target process dies before attachment in Hotspot * Review comments added * Add ASM URL for copyright note. * Normalize formatting. --------- Co-authored-by: krishnapriyars <Krishnapriya.RS@ibm.com>
1 parent 71448e3 commit 05dc85e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,11 @@ public Connection connect(String processId) throws IOException {
564564
throw new IllegalStateException("Could not create attach file: " + attachFile);
565565
}
566566
}
567+
try { // Keep canonical file for cleanup in case target process ends and /proc/<pid>/cwd link disappears
568+
attachFile = attachFile.getCanonicalFile();
569+
} catch (IOException ignored) {
570+
/* do nothing */
571+
}
567572
try {
568573
kill(processId, 3);
569574
int attempts = this.attempts;

0 commit comments

Comments
 (0)