[plt-scheme] Re: web-server: connection timeout with open file handles
My initial diagnosis on this may have been wrong.
I've added a line to instruct the web server to increase the
connection timeout every so often.
I get complete file downloads now, but file handles are still being
left open.
-- Dave
> Hi all,
>
> I'm having a couple of issues with timeouts in the web server. This
> is kind of related to the "dynamic-wind & kill-thread" thread.
>
> I'm using a servlet and make-response/incremental to serve files
> from the file system to web users. I've attached simplified test
> code below (tested on PLT 4.1.4.1).
>
> Three problems:
>
> - large file downloads can take a long time, and can be killed by
> the web server's connection timeout (default 60 seconds);
>
> - when the connection times out, the servlet thread is killed and
> leaves the file handle open permanently ("lsof -p <PID>").
>
> - over time, the web server accrues open file handles until it
> hits the OS-imposed limit ("ulimit -n") and stops working properly
> (connecting to Postgres in my case).
>
> I remember back in the day we had the same problem with files served
> using dispatch-files.ss. The solution there was to insert a call to
> adjust-connection-timeout! to increase the connection timeout for
> large files.
>
> Here it's not so simple because make-response/incremental can do
> more than just serve static files.
>
> I'd like to be able to call adjust-connection-timeout! from servlet
> code, but I don't think that feature is available from inside a
> servlet (no access to the connection object).
>
> Cheers,
>
> -- Dave