On 17/04/2023 19:51, Mark Thomas wrote:
Hi,

I have tried but am unable to recreate this.

Please provide the simplest possible web application (it should be possible to do this in a single Servlet) that demonstrates the issue.

To give you an idea of what I mean by a single servlet, here is the test case I was using:

https://github.com/markt-asf/tomcat-bugs/blob/main/src/main/java/org/apache/markt/MultiPartUpload2.java

(it is the 11.0.x version of the test but the code for upload should be the same across Tomcat versions)

Mark


Please make sure you provide the source code for the web application.

Thanks,

Mark


On 14/04/2023 19:40, William L. Cunningham wrote:
Thanks, yes it happens with any file upload.

-----Original Message-----
From: Mark Thomas <ma...@apache.org>
Sent: Friday, April 14, 2023 9:36 AM
To: users@tomcat.apache.org
Subject: Re: Tomcat 8.5.85 and above - Issue with file uploads

WARNING: This email originated from an external source. Please be careful when clicking on any links in external emails.

On 13/04/2023 21:40, William L. Cunningham wrote:
Environment:  Windows 2019 Standard with latest JDK 17 and Apache Tomcat 8.5.87.

When trying to upload a file to the application running off Tomcat (custom software), we are getting the following error since 8.5.85 (works fine on 8.5.84).

ERROR [2023-04-13 15:20:20]:
com.company.dataimporter.servlet.FileUpload::doPost::85 Cannot delete
C:\Program Files\Apache Software Foundation\Tomcat
8.5_Tomcat_Prod\work\Catalina\localhost\company\upload_1da07be9_7508_4
4d3_aee6_28d1d7989727_00000000.tmp
java.lang.IllegalStateException: Cannot delete C:\Program Files\Apache Software Foundation\Tomcat 8.5_Tomcat_Prod\work\Catalina\localhost\company\upload_1da07be9_7508_44d3_aee6_28d1d7989727_00000000.tmp
       at
org.apache.tomcat.util.http.fileupload.disk.DiskFileItem.delete(DiskFi
leItem.java:428) ~[tomcat-coyote.jar:8.5.87]

This same procedure works perfectly fine in 8.5.84.  It was something introduced with 8.5.85.  It also works fine on a Linux hosted version (Centos) for 8.5.84 and above.  So it appears to be Windows centric.

When I watch the procedure in the Catalina\localhost\company folder on 8.5.84, I see the tmp file generated and then immediately deleted (it's a small upload).  On 8.5.85 and above, it's locked and can't be deleted.  Thus causing the error.

Anyone have any thoughts?

Tomcat 8.5.85 includes an updated version of the Commons FileUpload code that throws an ISE if the temporary file can't be deleted.

https://github.com/apache/tomcat/commit/8d21b9ef4ae30f6f6474f00a72887338a5b745ac

It looks like this may have exposed an underlying Commons IO bug:

https://issues.apache.org/jira/browse/IO-788

Do you see this problem every time you try to upload a file?

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to