Disconnected while trying to download large files when using SelectChannelConnector

Detailed Description

This is a combination of the file being small enough to fit the Jetty file cache, but big enough to timeout (SO_TIMEOUT) while writing on the channel. If it timeouts, Jetty closes the connection.

Remedy

The maximum cached file size for a single file is controlled by the maxCachedFileSize parameter in the DefaultServlet. Default value is approximately 10GB. Timeout for SelectChannelConnector is controlled using setMaxIdleTime(int). Default value is 30 seconds.

If you are consistently running into these limits, play around with both these values to find a reasonable compromise for your application – either a longer timeout, or a smaller cache, or both.