|Summary:||"No such file or directory" after upgrade to poi-ooxml 3.12|
|Component:||OPC||Assignee:||POI Developers List <dev>|
Description laimutis.ignatavicius 2015-05-25 08:49:23 UTC
After poi-ooxml version upgrade from 3.10-FINAL to 3.12, tests of our software, which are running parallelly, began failing randomly: java.io.IOException: No such file or directory at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1006) at java.io.File.createTempFile(File.java:1989) at org.apache.poi.util.TempFile$DefaultTempFileCreationStrategy.createTempFile(TempFile.java:105) at org.apache.poi.util.TempFile.createTempFile(TempFile.java:60) at org.apache.poi.openxml4j.opc.ZipPackage.closeImpl(ZipPackage.java:347) at org.apache.poi.openxml4j.opc.OPCPackage.close(OPCPackage.java:426) We found changes in ZipPackage.closeImpl(): poi-ooxml 3.10-FINAL: org.apache.poi.openxml4j.opc.ZipPackage.closeImpl() line 343: File tempFile = File.createTempFile(generateTempFileName(FileHelper.getDirectory(targetFile)), ".tmp"); o poi-ooxml 3.12: org.apache.poi.openxml4j.opc.ZipPackage.closeImpl() line 347: File tempFile = TempFile.createTempFile(generateTempFileName(FileHelper.getDirectory(targetFile)), ".tmp"); In TempFile.createTempFile method temp files are creating in 'poifiles' subdirectory, which is marked with "deleteOnExit". When multiple applications in same computer are running simultaneously, some of them began failing. We tried to set system property "poi.keep.tmp.files" values where possible, but we are still getting failures... Our recommendations: a) not to try delete poifiles temp files directory that is used by multiple applications with poi integration; or b) create random poifilesxxxx temp files subdirectories for each application with poi integration.
Comment 1 Dominik Stadler 2015-05-25 19:43:25 UTC
The poi.keep.tmp.files property should prevent POI from cleaning those files completely, so it is strange that it does not solve the problem completely for you. Either some other process is removing this directory on your setup, e.g. temp-file-cleanup scripts or there are still POI-related processes running without that system property being set. In addition, according to how the deleteOnExit-hook in the JVM is implemented and the javadoc of File.delete(), it should suffice to put an unrelated file into the poifiles-directory to prevent it from being removed. Can you try if that is a workaround in your case?
Comment 2 htung 2015-08-11 06:15:07 UTC
Should this be fused with #57200 as duplicate? This bug makes it clear that the problem extends beyond the SXSSF component, but it's almost certainly the same bug.
Comment 3 Dominik Stadler 2016-03-12 15:38:38 UTC