You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use this library to extract zip files on a Linux server (about 6000 files per day). After running a few days, the OS reports a too many open files error.
I use lsof -p PID to list open files and found about 40000 zip files are opened by one process.
After analysing the code, this issue may caused by an unclosed RandomAccessFile in net.lingala.zip4j.io.inputstream.NumberedSplitRandomAccessFile#randomAccessFile
here is the sample code to reproduce the issue:
@TestpublicvoidnumberSplitFd() throwsIOException {
Stringname = "/path/to/random-files/random.out copy %d.zip.001";
for (inti = 1; i <= 10; i++) {
// open the file, and close it using try-with-resourcetry (RandomAccessFileraf = newNumberedSplitRandomAccessFile(String.format(name, i),
RandomAccessFileMode.READ.getValue())) {
}
}
// add a breakpoint here and use lsof to check opened files
}
Thanks for the detailed bug report. I appreciate that. I added the close method to NumberedSplitRandomAccessFile. Considering the urgency of this bug, I will make a (minor) release today after the build goes through.
Hi,
We use this library to extract zip files on a Linux server (about 6000 files per day). After running a few days, the OS reports a
too many open files
error.I use
lsof -p PID
to list open files and found about 40000 zip files are opened by one process.After analysing the code, this issue may caused by an unclosed RandomAccessFile in
net.lingala.zip4j.io.inputstream.NumberedSplitRandomAccessFile#randomAccessFile
here is the sample code to reproduce the issue:
test files:
random-files.zip
lsof -p PID | grep 'zip.001'
add an override
close
method can resolve this issueThe text was updated successfully, but these errors were encountered: