user18252786
user18252786

Reputation: 21

Tomcat 10 not closing files on the server

I recently upgraded to Tomcat 10. Everything is working perfectly except for one thing. If I download a file from the server via the browser, the file remains open on the server.

I'm running the following: Windows 11, java 11.0.12 2021-07-20 LTS, Tomcat 10.0.14, Firefox 97.0.1

In a new Firefox tab, I enter https://dg.localhost.com/nl/editions/NL202202.odt as the URL. Using Windows Resource Monitor I see the file open as soon as I press Enter. The file downloads and opens in Apache OpenOffice Writer. At this point, just close Writer.

Going back to the Resource Monitor the file on the server C:\webdevenv\dataGen\nl\editions\NL202202.odt remains open for approximately five to ten minutes. In my previous Tomcat 8 installation the file would close on the server as soon as the download was complete.

In server.xml I have the following connector:

    <Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"        sslImplementationName="org.apache.tomcat.util.net.openssl.OpenSSLImplementation" connectionTimeout="20000" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS">
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="C:/webdevenv/tomcat10/conf/lhkey.store" 
                         certificateKeyAlias="datagen"
                         certificateKeystorePassword="dataGenKey"
                         type="RSA"
                         certificateKeystoreType="PKCS12" />
        </SSLHostConfig>
    </Connector>

Is there any way to control how long Tomcat 10 keeps a file like this open?

Upvotes: 1

Views: 242

Answers (1)

user18252786
user18252786

Reputation: 21

Continuing to experiment with the settings in server.xml, I noticed the issue did not occur when using http: instead of https:. At this point I was pretty sure the issue was in the connector shown above. After reviewing all of the attributes and nested elements in the Tomcat 10 documentation, I commented out the UpgradeProtocol element. After restarting Tomcat the issue was resolved. I'm not sure exactly what this protocol does differently but it was definitely the source of the problem.

Upvotes: 1

Related Questions