Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-497

DeferredFileOutputStream produces unhandled IOExceptions if the java.io.tmpdir is deleted

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.4
    • Fix Version/s: None
    • Component/s: Streams/Writers
    • Labels:
    • Environment:

      unix-like operating systems where temporary disk storage is routinely purged; CentOS specifically


      In the event that the Java temporary directory is deleted prior to the DeferredFileOutputStream trying to use it, the stream will throw one of two different IOExceptions (depending on how the Stream was constructed).

      This may sound like an unrealistic use-case at first, but it is legitimate as one of my company's applications encountered it after the underlying operating system (CentOS) automatically purged the contents of its tmp directory. (The application uses Commons FileUpload, which invokes DeferredFileOutputStream and does not handle the error itself.) Our current work-around is to restart the server when this happens, but we feel that the underlying library should perhaps be intelligent enough to recover from such an error.

      Additionally, it seems an awkward experience that two different errors are produced based on how the stream was constructed. One approach produces a FileNotFoundException while the other produces a plain IOException.

      A small maven project containing a single JUnit test that highlights the error will be attached (see dfos-bug.tar.gz).


        1. dfos-bug.tar.gz
          3 kB
          Nicholas Byrd
        2. dfos-bug-v2.tar.gz
          3 kB
          Nicholas Byrd
        3. example_stack.txt
          6 kB
          Nicholas Byrd



            • Assignee:
              nbyrd Nicholas Byrd


              • Created:

                Issue deployment