1

We just upgraded Tomcat from 9.0 to 10.1, and Java from 8 to 11. everything is running fine except now we are having temp files pile up in Apache Software Foundation\Tomcat 10.1\work\Catalina\localhost\root. This is causing 502 errors after Java heap space issues. We see errors like this..

07-Feb-2023 23:33:11.414 SEVERE [http-nio-81-exec-3] org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun Error running socket processor
    java.io.UncheckedIOException: Cannot delete C:\Program Files\Apache Software Foundation\Tomcat 10.1\work\Catalina\localhost\root\upload_ac88107d_733f_4b9d_a3a3_9274a46f92e3_00000509.tmp
        at org.apache.tomcat.util.http.fileupload.disk.DiskFileItem.delete(DiskFileItem.java:429)
        at org.apache.catalina.core.ApplicationPart.delete(ApplicationPart.java:54)
        at org.apache.catalina.connector.Request.recycle(Request.java:451)
        at org.apache.catalina.connector.CoyoteAdapter.log(CoyoteAdapter.java:512)
        at org.apache.catalina.connector.CoyoteAdapter.checkRecycled(CoyoteAdapter.java:536)
        at org.apache.coyote.http11.Http11Processor.recycle(Http11Processor.java:1440)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.release(AbstractProtocol.java:1052)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:1024)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.io.IOException: Cannot delete C:\Program Files\Apache Software Foundation\Tomcat 10.1\work\Catalina\localhost\root\upload_ac88107d_733f_4b9d_a3a3_9274a46f92e3_00000509.tmp
        ... 14 more

Any ideas what could be the issue?

  • 1
    Ever since Windows Vista, system folders like `Program Files` are heavily protected, so are you sure you want to keep temp files there? Maybe you should check Tomcat document to see how to move the files out to a less sensitive folder. In all cases, the tomcat process needs write permission to the temp files so as to remove them. The actual steps to configure permissions depend on how you configure Tomcat on this Windows machine, which you didn't even reveal in the question body. – Lex Li Feb 09 '23 at 04:17
  • Maybe the file is being used by another thread or the permissions are insufficient. You can refer to related cases: https://stackoverflow.com/questions/6663202/cannot-delete-temp-folder-sometimes and https://stackoverflow.com/questions/50532263/java-delete-directory-ioexception-unable-to-delete-directory. – TengFeiXie Feb 09 '23 at 09:32
  • @TengFeiXie I think you're right... After monitoring it a bit some files are being deleted and some are not. This appears to be a situation where the file is in use and therefore unable to be deleted. – Zachary McArthur Feb 09 '23 at 15:48
  • Hey @ZacharyMcArthur. We are seeing the same issue on a Windows host. Have you managed to solve this in the meantime? Looking into the linked questions right now. – Tim Hilt Apr 28 '23 at 12:06

0 Answers0