2009/12/4 Tom Brown <[email protected]>:
> I added lockers, and now I get this error:
>
> #
> # Fatal error in src/api.h, line 370
> # CHECK(entered_contexts_.length() == 0) failed
> #
>
> The problem occurs when using any version greater or equal to 1.3.14,
> and not on Windows. From its change log, there is this entry:

This is almost certainly because you have used V8 API functions
without holding the lock.  Everything in v8.h counts as using the V8
API.

> "Fix the stack limits setting API to work correctly with threads. The
> stack limit now needs to be set to each thread which is used with V8."
>
> I am fairly certain this specific change is what is causing the

This change made V8 stricter about needing lockers, but didn't change
the rules.  It was necessary to get rid of a memory leak in the
threading code.

> problem.  I would like to know what the default limit is for the main
> thread so that I can set the same limit for each other thread.  I have

The default limit is an address kLimitSize lower than the current
stack pointer when V8 is initialized.  The important thing is that V8s
limit is more restrictive (numerically higher for a stack that grows
down) than the OS limit so that you get correct error messages from V8
if you exceed the stack limit.  If you hit the OS limit then you just
get a crash.

> looked through the code, and I have searched with google, but I cannot
> figure out how the main thread gets its default.



> Also, V8 appears to allocate memory for each new thread it encounters.
> Is there any way to cause that memory to be cleaned up once I know a
> thread will no longer be used?

Not as yet.  The amount per thread is rather modest.  Feel free to
assign a feature request to me if you file one in the issues tracker
on code.google.com/p/v8

>
>
> Thanks again,
> Tom Brown
>
>
> On Fri, Dec 4, 2009 at 2:10 PM, Erik Corry <[email protected]> wrote:
>> 2009/12/4 Matthias Ernst <[email protected]>:
>>> On Fri, Dec 4, 2009 at 8:37 PM, Erik Corry <[email protected]> wrote:
>>>> 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.
>>>
>>> I don't think this is not in line with what v8.h documents:
>>>
>>> http://v8.googlecode.com/svn/trunk/include/v8.h:
>>>  * Multiple threads in V8 are allowed, but only one thread at a time
>>>  * is allowed to use V8.  The definition of 'using V8' includes
>>>  * accessing handles or holding onto object pointers obtained from V8
>>>  * handles.  It is up to the user of V8 to ensure (perhaps with
>>>  * locking) that this constraint is not violated.
>>>  *
>>>  * If you wish to start using V8 in a thread you can do this by constructing
>>>  * a v8::Locker object. ...
>>>
>>> This very much suggest you can use any mechanism you like, and be it
>>> "just knowing" and that v8::Locker is just one convenient one.
>>
>> Yes, that's very misleading.  I have filed a bug to remind myself to fix it.
>>
>> --
>> Erik Corry
>>
>> --
>> v8-users mailing list
>> [email protected]
>> http://groups.google.com/group/v8-users
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>

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

Reply via email to