Interrupt Execution

Hi,

I’m still searching for a way to halt or interrupt the execution of an
IronRuby script. At the moment I do it by executing each script on a
separate thread and call Thread.Abort but that is resulting in a memory
and thread leak in my server application. As things have got busier on
the server the leak has reduced the time the server can stay up from
days to half a day or less.

I came across the DLR hosting document on CodePlex
http://dlr.codeplex.com/Wiki/View.aspx?title=Docs%20and%20specs and was
wondering if there is anything in the IronRuby pipeline regarding
“Interrupt Execution” (chapter 3.4 page 27 of the spec)? It’s exactly
what I’m after and also describes the exact issue I’m encountering with
the rude thread aborts. I’ve quoted the relevant text below for
interested parties.

Other than that is it possible to execute an IronRuby script line by
line? I have been able to execute individual expressions but as soon as
I try something like a multi-line expression like a case statement I
haven’t been able to find a way.

“Interrupt Execution: Language supports DLR mechanisms for host to abort
execution cleanly so that host can interrupt runaway code. If we allow
languages to avoid this work, then those langs cannot be used in the
host’s process, cannot support in-situ REPLs for interactive
development, etc. If the language uses DLR compilation or
interpretation, they should not need to do anything. This is important
because if the host has to stop execution by calling Thread.Abort or
other rude abort, the thread could have transitioned into an unsafe
portion of the host’s code. This could happen via the script code
calling back on the host OM which in turn calls an internal API not
coded for rude aborts.”

Thanks,

Aaron C.

After spending a few hours delving into the DLR source I suspect the
“interrupt execution” implementation is more related to the DLR core
than IronRuby so I’ve posted a question over there
http://dlr.codeplex.com/Thread/View.aspx?ThreadId=62052.

Regards,

Aaron