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

From: Dave Gurnell (d.j.gurnell at gmail.com)
Date: Thu Apr 23 03:51:41 EDT 2009

A little bit more on this. I added some simple printf statements like  
this:

   (printf "Starting download~n")
   (call-with-input-file ...etc...)
   (printf "Finishing download~n")

After a night's operation, the number of "Start" messages seems to  
exceed the number of
"Finish" messages by roughly the number of open file handles. I guess  
this is to be expected.
At least there's some hard evidence that it's abrupt disconnections or  
terminations that are
leaking resources.

I guess the questions now are:

   - why are the connections getting terminated (client initiated  
disconnection?);
   - why is call-with-input-port not sorting itself out (abrupt thread  
termination?);
   - is there any way I can fix it, even temporarily?

Cheers,

-- Dave

> Regarding the file handles, I presume that are your file handles from
> call-with-input-file?
>
> When a servlet runs, its resources are owned by the servlet's
> custodian, so they are shared by the entire servlet and not just the
> instance or connection. This means that if you don't free resources,
> it won't be removed until the servlet is, which only happens when you
> conf/refresh-servlets.
>
> Can you track down what kind of file handles are being retained? I
> don't think that there's a problem with call-with-input-file, but I'd
> like more info.
>
> Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090423/ca00a0d9/attachment.html>

Posted on the users mailing list.