[plt-scheme] Cleanup on servlet timeout

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Jul 26 08:43:44 EDT 2008

No, but that's because it doesn't GC anything.

custodian-shutdown-all kills all tcp connections, closes all files,
kills all threads -- that kind of thing. It essentially revokes any
resource utilization (for the custodian in question), where the CPU is
considered a resource (one that you create threads to use).

So, if Henk's post-thunks are doing somethign at the C-level, probably
the right fix is to add that cleanup to the custodian shutdown, also
at the C level.

If the dynamic-winds are doing something else that just preserves
Scheme invariants, then he can rewrite the code to make it kill-safe
(which it apparently isn't). The best pointer I have to explaining
these ideas and giving an example is our PLDI 2004 paper. I hope
that's a good start.

http://www.cs.utah.edu/plt/kill-safe/

(www.cs.utah.edu seems to be down, but I think the paper is also
available in other places. citeseer, perhaps)

Robby

On Sat, Jul 26, 2008 at 7:38 AM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
> So there you have it! Does it execute will-executors?
>
> Jay
>
> On Sat, Jul 26, 2008 at 8:31 AM, Robby Findler <robby at cs.uchicago.edu> wrote:
>> No, custodian-shutdown-all doesn't execute any thunks!
>>
>> Robby
>>
>> On Sat, Jul 26, 2008 at 7:29 AM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
>>> Henk,
>>>
>>> The timeout mechanism kills a thread by using custodian-kill-all on
>>> the custodian for that thread. I think, but am not positive, that this
>>> executes the post-thunks of dynamic-winds in the body. Hopefully
>>> knowing how it works will help you debug further. If you think there
>>> is a bug, perhaps you can write a small example that I can test with?
>>>
>>> Jay
>>>
>>> On Sat, Jul 26, 2008 at 12:04 AM, Henk Boom <lunarc.lists at gmail.com> wrote:
>>>> I'm using the timeout dispatcher to stop responses which take too long
>>>> to compute. Normally when I throw an exception, the sqlite bindings
>>>> ensure that I release the database and I use dynamic-wind to release
>>>> my own locks I have claimed. However, when the request times out this
>>>> cleanup doesn't happen, I'm guessing because the thread is terminated
>>>> in a harsher way. Is there a way I could throw an exception in the
>>>> thread after a timeout instead of simply killing it?
>>>>
>>>> Thanks,
>>>>    Henk
>>>> _________________________________________________
>>>>  For list-related administrative tasks:
>>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>>
>>>
>>>
>>>
>>> --
>>> Jay McCarthy <jay.mccarthy at gmail.com>
>>> http://jay.teammccarthy.org
>>> _________________________________________________
>>>  For list-related administrative tasks:
>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>
>>>
>>
>
>
>
> --
> Jay McCarthy <jay.mccarthy at gmail.com>
> http://jay.teammccarthy.org
>
>


Posted on the users mailing list.