I'm using the Locker API to make an Isolate accessible from multiple 
threads and it seems to be working well so far.

The problem is that when using cppheap(oilpan), when I call a JS Function 
via an Isolate, it triggers a GC Task sometimes, which in turn calls 
PreFinalizerHandler::InvokePreFinalizers() inside CppHeap. It eventually 
hits DCHECK(CurrentThreadIsCreationThread()), which causes the program to 
crash.

Backtrace (based on 12.7.224.12)
* frame #0: 0x0000aaaaaf3bfeb0 `v8::base::OS::Abort() at 
platform-posix.cc:701:7
  frame #1: 0x0000aaaaaf3be29c `V8_Fatal(char const*, int, char const*, 
...) at logging.cc:215:3
  frame #2: 0x0000aaaaaf3bdc78 `v8::base::(anonymous 
namespace)::DefaultDcheckHandler(char const*, int, char const*) at 
logging.cc:59:3
  frame #3: 0x0000aaaab00c729c 
`cppgc::internal::PreFinalizerHandler::InvokePreFinalizers() at 
prefinalizer-handler.cc:57:3
  frame #4: 0x0000aaaab00b634c 
`cppgc::internal::HeapBase::ExecutePreFinalizers() at heap-base.cc:169:26
  frame #5: 0x0000aaaaaf68ef54 
`v8::internal::CppHeap::FinishMarkingAndStartSweeping() at 
cpp-heap.cc:939:51
  frame #6: 0x0000aaaaaf710608 
`v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, 
v8::internal::GarbageCollectionReason, char const*) at heap.cc:2411:32
  frame #7: 0x0000aaaaaf729d30 
`v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, 
v8::internal::GarbageCollectionReason, 
v8::GCCallbackFlags)::$_1::operator()() const at heap.cc:1767:9
  frame #8: 0x0000aaaaaf7297b4 `void 
heap::base::Stack::SetMarkerAndCallbackImpl<v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace,
 
v8::internal::GarbageCollectionReason, 
v8::GCCallbackFlags)::$_1>(heap::base::Stack*, void*, void const*) at 
stack.h:176:5
  frame #9: 0x0000aaaab00d75d8 `PushAllRegistersAndIterateStack + 44
  frame #10: 0x0000aaaaaf70bdc8 
`v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, 
v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) at 
heap.cc:1731:11
  frame #11: 0x0000aaaaaf70d988 
`v8::internal::Heap::FinalizeIncrementalMarkingAtomically(v8::internal::GarbageCollectionReason)
 
at heap.cc:3953:3
  frame #12: 0x0000aaaaaf72e7a4 
`v8::internal::IncrementalMarkingJob::Task::RunInternal() at 
incremental-marking-job.cc:137:34
  frame #13: 0x0000aaaaaf3c2e64 
`v8::platform::DefaultPlatform::PumpMessageLoop(v8::Isolate*, 
v8::platform::MessageLoopBehavior) at default-platform.cc:173:9
...


I can find mentions of the v8::Locker API in the Attach/DetachCppHeap in 
v8-isolate.h and the CppHeap in v8-cppgc.h, but I can't find any tests on 
how this can be used with the v8::Locker API.

...But I know this is thread-local data that can't be transferred to other 
threads, so I have a vague feeling that I should use a combination of 
AttachCppHeap/DetachCppHeap(...and v8::CppHeap::Create, if needed) to 
replace it every time when an Isolate moves back and forth between threads, 
but I have no idea what side effects this will cause.

If anyone is familiar with the above case, can someone give me some 
guidelines?

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
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 v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/46382138-a2fb-4ccf-a88a-7b07e0c718ean%40googlegroups.com.

Reply via email to