-
Notifications
You must be signed in to change notification settings - Fork 937
Closed
Labels
Description
Describe the bug
The call of AsyncProfiler.getInstance() throws such exception:
java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: var/tmp/libasyncProfiler-3235132534849877537.so
This is because the target application has set the java.io.tmpdir to a relative path, the returning of the following code returns a relative path.
File file = File.createTempFile("libasyncProfiler-", ".so",
extractPath == null || extractPath.isEmpty() ? null : new File(extractPath));It's not esasy to change the property of java.io.tmpdir to an absolution path for the target application,so it's better to fix this inside the API.
The fix is simple, just get the absolution file after creating the temp file.
File file = File.createTempFile("libasyncProfiler-", ".so",
extractPath == null || extractPath.isEmpty() ? null : new File(extractPath));
file = filePath.getAbsoluteFile(); // <=== add this new lineEven though async-profiler allows user to set a directory for the lib via one.profiler.extractPath, if the path is set to a relative path like tmp/test, we will encounter this problem too.
Expected vs. actual behavior
No response
Reproduction Steps
No response
Additional Information/Context
No response
Async-profiler version
4.1
Environment details
No response