Hello,
we are using Tomcat 10.0.16 under windows.
For sending files to the browser, we are using sendfile by setting the 
attribute "org.apache.tomcat.sendfile.filename".
Streaming an image to the browser works well in this way.
But we observed that if the user tries to delete the file afterwards, there is 
still a file-handle on this file.

I took a look at NioEndpoint.java --> 
https://github.com/apache/tomcat/blob/main/java/org/apache/tomcat/util/net/NioEndpoint.java

At line 869 there is a stream opened:
FileInputStream fis = new FileInputStream(f);

However, there is no close in this method. Maybe this might cause the open 
file-handle?

We are using protocol="org.apache.coyote.http11.Http11NioProtocol".. I think 
there are different implementations for sendfile-feature.
The open file-handle can be observer via ProcessExplorer from Microsoft.

Thanks in advance!
Thomas

Reply via email to