2009/12/4 Tom Brown <[email protected]>:
> I have embedded V8 into a server application as a request processing
> mechanism. Only one request is ever touching the V8 engine at any
> given time, so I'm not concerned with multi-threading. However, each

If you are using V8 from more than one thread then you have to use the
Locker objects from v8.h.  It is not enough that you only use it from
one thread at a time, you also have to use Lockers in order to tell V8
which thread you are in.

> request is processed by it's own thread. It seems that any time a
> thread that is not the main thread tries to call JS code, a stack
> overflow exception is thrown.
>
> This does not happen on windows, and it does not happen with V8
> versions 1.3.13.5 and lower.

That is probably just luck.

> It does happen on linux, with V8 versions 1.3.14 and higher.
>
> Due to the change log between those versions, I understand that I can
> call SetResourceConstraints before calling into V8. However, the docs

SetResourceConstraints is used both for heap size and stack limits.
The heap size setting must be done before V8 is initialized.  The
stack limits must be done while holding a lock if you are using
multiple threads.

> say that default values will be used if this isn't called, and I'm
> concerned because the default values for new threads seem to be
> different from the default values used by the main thread.
>
> Can somebody on this list help me out by either providing an example
> of correct, threaded usage of SetResourceConstraints or by explaining
> why this is a bad idea?

There is an example of its use in one of the tests in v8/test/cctest

-- 
Erik Corry

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

Reply via email to