[ 
https://issues.apache.org/jira/browse/FILEUPLOAD-368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18073593#comment-18073593
 ] 

Bruno Antunes commented on FILEUPLOAD-368:
------------------------------------------

I investigated this further and was able to reproduce a difference between 
Commons FileUpload 1.5 and 1.6.0 when the {{InputStream}} returned by 
{{FileItem.getInputStream()}} is not explicitly closed by application code.

Reproducer:
 * Java 8 / Servlet 3.1 servlet using {{DiskFileItemFactory}} and 
{{ServletFileUpload}}
 * no {{FileCleaningTracker}}
 * no {{FileItem.delete()}}
 * multipart request containing one file field plus a few text fields
 * stream closing controlled by a servlet init parameter

Observations:
 * With FileUpload 1.5, after forcing GC, the temp upload files disappear and 
no deleted upload files remain visible in {{{}lsof +L1{}}}.
 * With FileUpload 1.6.0, after the same test, temp files are unlinked but the 
corresponding file descriptors remain visible as {{(deleted)}} in {{{}lsof 
+L1{}}}.
 * If the stream is explicitly closed, I do not observe the issue.

This suggests a regression in the cleanup path for disk-backed 
{{{}FileItem{}}}s when the input stream is left open.

> 1.6.0 unlike 1.5:  brought on an issue where temporary files and descriptors 
> were not being freed
> -------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-368
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-368
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.6.0
>            Reporter: David Campbell
>            Priority: Major
>         Attachments: image-2025-12-02-13-22-04-101.png, 
> image-2025-12-02-13-24-56-498.png
>
>
> An upgrade of commons-fileupload from 1.5 to 1.6.0 brought on a problem on 
> high-load servers where uploaded files were not being deleted and the server 
> file descriptor utilisation kept growing.  On all server instances, file 
> resource utilisation kept growing to the point where it was filling /tmp 
> completely and then the server instances needed restarting to solve, as file 
> space is not reclaimed even on file deletion on Unix servers when file 
> descriptors are still open.  The same issue occurred on all our server 
> instances.
> We had a major production incident as a result.
> Rolled back to 1.5.  That fixed the issue, problem completely gone.
> Don't know any further details of the whys at this point.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to