Were you setting the global context before starting the thread? Or
were you setting the global context inside of the thread? It sounds
like the former and we're doing the latter. So I don't think it's the
same at first blush (though could be related).
We're setting the global context via a Context::Scope object just
before the call to GetPropertyNames in the same thread. Specifically,
the function that is calling V8 and crashing looks like:
int CLVV8Array::GetSizeImpl() {
v8::Locker locker;
if(CHECKFAILED(!m_hContext.IsEmpty())) {
return -1;
}
if(CHECKFAILED(!m_hArray.IsEmpty())) {
return -1;
}
Context::Scope objContextScope(m_hContext);
HandleScope objHandleScope;
Handle<Array> hPropNameArray = m_hArray->GetPropertyNames();
if(CHECKFAILED(!hPropNameArray.IsEmpty())) {
return -1;
}
Handle<Value> hLength = hPropNameArray->Get(String::New("length"));
if(CHECKFAILED(!hLength.IsEmpty())) {
return -1;
}
return hLength->Int32Value();
}
matt
On Tue, Jun 1, 2010 at 4:53 PM, Stephan Beal <[email protected]> wrote:
> On Tue, Jun 1, 2010 at 10:46 PM, Matt Seegmiller <[email protected]> wrote:
>>
>> We've been getting a crash in V8 sporadically and I was curious if
>> there is someone who might know something obvious we're doing to cause
>> it, or if this might be a bug, or anything helpful.
>>
>> I've posted before about using V8 in a multithreaded game engine.
>> This is the same engine.
>
> i also experienced inconsistent (but frequent) crashes when fetching the
> global context in a threaded routine. Specifically, the context was coming
> back as null.
> i ended up working around it by storing the context handle before my thread
> was started, passing that object as part of the thread's "run data", and
> then accessing the context (from within the new thread) through there.
> --
> ----- stephan beal
> http://wanderinghorse.net/home/stephan/
>
> --
> 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