Okay, after a lot of trial and error, i think i got the hang of it... Had 
to use both Locker and Unlocker to get it to work.

On Thursday, October 10, 2013 5:28:52 PM UTC+3, ioannis wrote:
>
> Well, you make it sound soo easy ...
> I have read the documentation in v8.h and how it was done in d8.cc but i 
> still cant get ti to work.
>  
>
> On Wednesday, October 9, 2013 11:37:50 AM UTC+3, Ben Noordhuis wrote:
>>
>> On Wed, Oct 9, 2013 at 4:15 AM, ioannis <[email protected]> wrote: 
>> > Ok, so i'm going nuts here, v8 v. 
>> > 
>> > I have a worker thread that is executed based on events raised from my 
>> > object. 
>> > 
>> > The thread uses the same isolate and context from the JS object 
>> > 
>> > So the thread is initiated like below and is working. 
>> > 
>> > 
>> > Isolate* isolate = object_->isolate_; 
>> > Isolate::Scope isolate_scope(isolate); 
>> > HandleScope handle_scope(isolate); 
>> > Context::Scope context_scope(isolate->GetCurrentContext()); 
>> > 
>> > ... 
>> > 
>> > Local<Object> new_obj(obj_templ->NewInstance()); <---- 
>> > 
>> > 
>> > The problem arises when v8 runs out of memory and v8 calls the garbage 
>> > collector 
>> > 
>> > to free some space before creating the object. Then i get a crush: 
>> > 
>> > 
>> > # 
>> > # Fatal error in ..\..\src\frames.cc, line 1333 
>> > # CHECK(it.done()) failed 
>> > # 
>> > 
>> > 
>> > With the following stack: 
>> > 
>> >   v8::internal::OS::DebugBreak() Line 953 C++ 
>> >   v8::internal::OS::Abort() Line 941 C++ 
>> >   V8_Fatal(0x00efa784, 1333, 0x00efa770, ...) Line 86 C++ 
>> >   v8::internal::EntryFrame::Iterate(0x04c2e498) Line 1333 C++ 
>> >   v8::internal::Isolate::Iterate(0x04c2e498, 0x017b4e8c) Line 497 C++ 
>> >   v8::internal::Isolate::Iterate(0x04c2e498) Line 508 C++ 
>> >   v8::internal::Heap::IterateStrongRoots(0x04c2e498, 
>> VISIT_ALL_IN_SCAVENGE) 
>> > Line 6383 C++ 
>> >   v8::internal::Heap::IterateRoots(0x04c2e498, VISIT_ALL_IN_SCAVENGE) 
>> Line 
>> > 6357 C++ 
>> > v8::internal::Heap::Scavenge() Line 1395 C++ 
>> >   v8::internal::Heap::PerformGarbageCollection(SCAVENGER, 0x04c2e568) 
>> Line 
>> > 958 C++ 
>> >   v8::internal::Heap::CollectGarbage(NEW_SPACE, SCAVENGER, 0x00e23fb0, 
>> > 0x00000000) Line 681 C++ 
>> >   v8::internal::Heap::CollectGarbage(NEW_SPACE, 0x00e23fb0) Line 546 
>> C++ 
>> >   v8::internal::CopyAddConstantDescriptor({...}, {...}, {...}, FROZEN, 
>> > OMIT_TRANSITION) Line 1991 C++ 
>> >   v8::internal::JSObject::AddConstantProperty({...}, {...}, {...}, 
>> FROZEN, 
>> > INSERT_TRANSITION) Line 2011 C++ 
>> >   v8::internal::JSObject::AddProperty({...}, {...}, {...}, FROZEN, 
>> > kNonStrictMode, MAY_BE_STORE_FROM_KEYED, PERFORM_EXTENSIBILITY_CHECK, 
>> > OPTIMAL_REPRESENTATION, ALLOW_AS_CONSTANT, INSERT_TRANSITION) Line 2088 
>> C++ 
>> >   v8::internal::JSObject::SetPropertyForResult({...}, 0x04c2e828, 
>> {...}, 
>> > {...}, FROZEN, kNonStrictMode, MAY_BE_STORE_FROM_KEYED) Line 3958 C++ 
>> >   v8::internal::JSReceiver::SetProperty({...}, 0x04c2e828, {...}) Line 
>> > 3421 C++ 
>> >   v8::internal::JSReceiver::SetProperty({...}, {...}, {...}, FROZEN, 
>> > kNonStrictMode, MAY_BE_STORE_FROM_KEYED) Line 2764 C++ 
>> >   v8::internal::Runtime::SetObjectProperty(0x017b3560, {...}, {...}, 
>> {...}, 
>> > FROZEN, kNonStrictMode) Line 5198 C++ 
>> >   v8::internal::__RT_impl_Runtime_SetProperty({...}, 0x017b3560) Line 
>> > 5349 C++ 
>> >   v8::internal::Runtime_SetProperty(4, 0x04c2e9dc, 0x017b3560) Line 
>> 5324 C++ 
>> >   v8::internal::Invoke(false, {...}, {...}, 2, 0x04c2eb6c, 0x04c2ec5f) 
>> Line 
>> > 119 C++ 
>> >   v8::internal::Execution::Call(0x017b3560, {...}, {...}, 2, 
>> 0x04c2eb6c, 
>> > 0x04c2ec5f, false) Line 183 C++ 
>> >   v8::internal::Execution::ConfigureInstance(0x017b3560, {...}, {...}, 
>> > 0x04c2ec5f) Line 789 C++ 
>> >   v8::internal::Factory::ConfigureInstance({...}, {...}, 0x04c2ec5f) 
>> Line 
>> > 1634 C++ 
>> >   v8::internal::HandleApiCallHelper<1>({...}, 0x017b3560) Line 1164 C++ 
>> >   v8::internal::Builtin_Impl_HandleApiCallConstruct({...}, 0x017b3560) 
>> Line 
>> > 1221 C++ 
>> >   v8::internal::Builtin_HandleApiCallConstruct(2, 0x04c2ecbc, 
>> 0x017b3560) 
>> > Line 1220 C++ 
>> >   v8::internal::Invoke(false, {...}, {...}, 1, 0x04c2ee68, 0x04c2eebf) 
>> Line 
>> > 119 C++ 
>> >   v8::internal::Execution::Call(0x017b3560, {...}, {...}, 1, 
>> 0x04c2ee68, 
>> > 0x04c2eebf, false) Line 183 C++ 
>> >   v8::internal::Execution::InstantiateObject({...}, 0x04c2eebf) Line 
>> 772 C++ 
>> >   v8::ObjectTemplate::NewInstance() Line 5308 C++ 
>> > 
>> > Can someone help me out here, or give me pointer of what is going wrong 
>> here 
>> > ? 
>> > Thanks. 
>>
>> V8 is not thread-safe by default.  If you are calling into the runtime 
>> from different threads, you need to lock appropriately with Locker 
>> objects. 
>>
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to