You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2018/01/18 06:02:37 UTC

[Bug 62012] New: Disposing POI temporary files in multithreaded system

https://bz.apache.org/bugzilla/show_bug.cgi?id=62012

            Bug ID: 62012
           Summary: Disposing POI temporary files in multithreaded system
           Product: POI
           Version: 3.17-FINAL
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: cohen.yaniv.il@gmail.com
  Target Milestone: ---

Hi,
I'm using POI SXSSFWorkbook for creating XLSX files in multithreaded system.
Since i read that there are issues with disposing the temporary files in when
using the DefaultTempFileCreationStrategy (with poifiles directory), i created
each thread is own temporary directory:

private TempFileCreationStrategy createTempFileCreationStrategy(File
poiTempFileDirectory) {
        return new TempFileCreationStrategy() {
            @Override
            public File createTempFile(String prefix, String suffix) throws
IOException {
                if (!poiTempFileDirectory.exists()) {
                    poiTempFileDirectory.mkdir();
                }
                File newFile = File.createTempFile(prefix, suffix,
poiTempFileDirectory);
                return newFile;
            }

            @Override
            public File createTempDirectory(String prefix) throws IOException {
                return null;
            }
        };


This is the code while finishing handling the SXSSFWorkbook object:

       // Write the Stream and close it
        workBook.write(outputStream);

            outputStream.close();

        } catch (FileNotFoundException e) {
            throw e;
        } catch (IOException e) {
            throw e;
        } catch (Exception e) {
            throw e;
        } finally {
            //Close the workBook
            workBook.close();
            //deleting the temporary files
            workBook.dispose();
        }

But still, from time to time, i'm getting an exception during the dispose. One
thread is throwing exception while trying to delete the temporary files of
another thread and the message is:
"dc319a2c-a663-4cb7-9f13-f7e8cc14c186/poi-sxssf-sheet-xml6608967316211277648.gz
(No such file or directory)" 

Thanks in advanced

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62012] Disposing POI temporary files in multithreaded system

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62012

--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
Can you post your complete TempFileCreationStrategy? The code you showed does
not look complete. I would like to try to reproduce or at least add a similar
test to Apache POI.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62012] Disposing POI temporary files in multithreaded system

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62012

--- Comment #2 from cohen.yaniv.il@gmail.com ---
Hi Dominik,
I'm getting this exception very rarely, (around every 1,000 usings), i'm trying
to get the stack trace. The moment i'll get it, i'll send it to you.

Thanks
Yaniv

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62012] Disposing POI temporary files in multithreaded system

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62012

--- Comment #3 from PJ Fanning <fa...@yahoo.com> ---
Is it possible that some external process is reaping files from the temp
directory?
In my applications, I try to use an explicit java.io.tmpdir to avoid using
/tmp. I have multi-threaded apps using POI and have not hit issues with temp
files being deleted while they are still in use.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62012] Disposing POI temporary files in multithreaded system

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62012

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #5 from Dominik Stadler <do...@gmx.at> ---
I tried to reproduce this with a simple threaded TempFileCreationStrategy, but
I could not produce any problem or leftover file with it, thus I am closing
this as WORKSFORME for now, please reopen when you can provide some more
information that can allow to reproduce this.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62012] Disposing POI temporary files in multithreaded system

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62012

Stefan Thurnherr <st...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |st.mailinglists@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62012] Disposing POI temporary files in multithreaded system

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62012

cohen.yaniv.il@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cohen.yaniv.il@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62012] Disposing POI temporary files in multithreaded system

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62012

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
Can you post the full stacktrace to let us see where exactly this happens?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org