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
ARROW-17794: [Java] Force delete jni lib file on JVM exit #14189
Conversation
|
@@ -29,6 +29,8 @@ | |||
import java.util.List; | |||
import java.util.Set; | |||
|
|||
import org.apache.commons.io.FileUtils; |
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 not needed to add commons-io
as a Dataset module dependency?
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.
Thanks for your attension, I have change the way to delete file. No need to use FileUtils as it is a file.
@@ -79,6 +79,7 @@ private void load(String name) { | |||
final String libraryToLoad = System.mapLibraryName(name); | |||
try { | |||
File temp = File.createTempFile("jnilib-", ".tmp", new File(System.getProperty("java.io.tmpdir"))); | |||
temp.deleteOnExit(); |
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.
Test: mvn -Darrow.cpp.build.dir=/Users/arrow/lib -Dtest="TestFileSystemDataset#testBaseOrcRead" clean test
Before the changes:
- target/jnilib-11079005003293013490.tmp
- target/jnilib-9915730910284592509.tmp
After the changes (1 tmp was deleted):
- target/jnilib-9915730910284592509.tmp
Could be possible to force delete also the another JNI file created?
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.
Sure, I can check and resolve this.
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.
Thank for your double check. I have remove the extra lib file and checked it in my environment.
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.
Awesome, thank you a lot
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.
LGTM, thank you
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.
Thanks!
Benchmark runs are scheduled for baseline = be30611 and contender = 67f5ac8. 67f5ac8 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
@github-actions crossbow submit java-jars |
Revision: a0a821f Submitted crossbow builds: ursacomputing/crossbow @ actions-727dfc5f94
|
Use `File.deleteOnExit` to delete jni lib file on JVM exit. `File.deleteOnExit` actually add a shut down hook to make sure file delte. Authored-by: jackylee-ch <lijunqing@baidu.com> Signed-off-by: David Li <li.davidm96@gmail.com>
Use `File.deleteOnExit` to delete jni lib file on JVM exit. `File.deleteOnExit` actually add a shut down hook to make sure file delte. Authored-by: jackylee-ch <lijunqing@baidu.com> Signed-off-by: David Li <li.davidm96@gmail.com>
Use
File.deleteOnExit
to delete jni lib file on JVM exit.File.deleteOnExit
actually add a shut down hook to make sure file delte.