[plt-scheme] Re: web-server: connection timeout with open file handles

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Wed Apr 22 10:57:45 EDT 2009

I presume that you are using adjust-timeout! ? Or are you using a
dispatcher that wraps another and does something to the connection
while it runs?


On Wed, Apr 22, 2009 at 8:07 AM, Dave Gurnell <d.j.gurnell at gmail.com> wrote:
> 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
>> 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
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.