Script termination from the side has now been added to V8.  Look for
the TerminateExecution methods in the API and have a look at the
test/cctest/test-thread-termination.cc test file for examples of using
it.

Cheers,    -- Mads

On Thu, Jul 23, 2009 at 10:53 AM, Kenji<[email protected]> wrote:
>
> Hi all, I'm looking for an execution time-out feature as well.
> It's sad to know v8 doesn't have a way to do that, because I can't let
> any script to block my server.
>
> I really hope this missing feature will be implemented very soon.
>
> Cheers,
> Kenji
>
>
> On 7月23日, 下午4時18分, Mads Sig Ager <[email protected]> wrote:
>> Hi Martin,
>>
>> you are not missing anything.  Currently, using a separate process
>> that you can kill if your JavaScript enters an infinite loop or
>> otherwise takes too much time is the only way to go.  We are
>> considering adding a way of terminating V8 execution from the side
>> (which would lead to throwing a thread termination exception which
>> cannot be caught by JavaScript try catch handlers), but it is not
>> there yet.
>>
>> Cheers,    -- Mads
>>
>>
>>
>> On Thu, Jul 23, 2009 at 10:12 AM, Martin Lemke<[email protected]> wrote:
>>
>> > I would like to monitor the execution of the script in v8,
>> > interrupting it if the execution takes an excessive amount of time,
>> > e.g. as a result of an endless loop. If you are familiar, SpiderMonkey
>> > JS engine has JS_SetOperationCallback (JS_SetBranchCallback) API which
>> > can be adopted for that purpose.
>>
>> > From what I learned about v8, the only way would be to run an instance
>> > of the v8 interpreter in a separate process, monitor it externally and
>> > terminate the process when I decide that the processing takes too much
>> > time.
>>
>> > I hoped that SetCounterFunction and SetCreateHistogramFunction may
>> > help but apparently they do not cover the execution stage, or at least
>> > they do not produce anything if I am inside an endless loop which
>> > doesn't affect the garbage collection.
>>
>> > Could be that I missed something? Is there a better way to monitor the
>> > time of the execution and interrupt it when necessary?
>>
>> > Thanks,
>> > Martin
> >
>

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to