I don't think it's possible / allowed to use an Isolate from multiple
threads. The simplest way to do this would be for each thread to have their
own Isolate (and that's how Chromium does it).

Based on just the error message, I'd guess that you set up the Isolate on
the main thread, and then invoke the compilation of some script on a
non-main thread, and that's where the check fails. But that's not the case
here? What's the stack trace when that check fails?

Another guess, could it be that we schedule some tasks to be executed in
the main thread (which is not the isolate's thread) and they then fail when
executed... but that also doesn't look probable given the code snippet,
esp. if you're saying that you do create the isolate on the main thread.


On Thu, Oct 12, 2017 at 1:15 PM, <[email protected]> wrote:

> Hi, Marja.
>
> On Thursday, October 12, 2017 at 3:48:49 PM UTC+5, Marja Hölttä wrote:
>>
>>
>>
>> On Mon, Oct 9, 2017 at 9:11 PM, <[email protected]> wrote:
>>
>>> Hi, guys.
>>>
>>> I'm having the following assertion failure:
>>>
>>> 10-05 11:04:10.654 14154-14154 E/v8: #
>>>                                      # *Fatal error in
>>> ../../v8/src/compiler.cc, line 87*
>>>                                      #
>>> 10-05 11:04:10.654 14154-14154 E/v8: Debug check failed:
>>> ThreadId::Current().Equals(compilation_info()->isolate()->thread_id()).
>>> 10-05 11:04:10.654 14154-14154 E/v8: #
>>>
>>> Can anyone explain me what it means?
>>>
>>>
>> The check checks "that we're on the main thread", or, more specifically,
>> that the current thread is the thread associated to the isolate (which is
>> the main thread from that V8 instance's point of view). (But based on
>> below, this is the answer you already knew maybe?)
>>
>
> Yes, this was clear from the very beginning. The question was once thread
> id is set in Isolate during instantiation can it be changed?
> The answer seems to be "yes it can be changed after it's set in
> Isolation", though i did not find actual confirmation.
> It's difficult to check because it's internals of V8 and i can't just use
> fprintf() because i'm running it on Android and
> i'm not enough experienced in V8 and Chromium source code.
>
>
>>
>>
>>
>>
>>> I'm working on integration of some third-party product into Chromium
>>> (Android) that is working in Browser process (main).
>>> The product uses Chromium's V8 and is creating new Isolate using
>>> IsolateHolder:
>>>
>>> // thread
>>> thread = new base::Thread("MyProductThread");
>>> thread->Start();
>>>
>>> #ifdef V8_USE_EXTERNAL_STARTUP_DATA
>>> LOG(WARNING) << "MyProduct: loading v8 snapshot & natives ...";
>>> gin::V8Initializer::LoadV8Snapshot();
>>> gin::V8Initializer::LoadV8Natives();
>>> LOG(WARNING) << "MyProduct: loaded v8 snapshot & natives";
>>> #endif
>>>
>>>
>>> LOG(WARNING) << "MyProduct: initialize isolate holder";
>>> gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
>>>                                gin::IsolateHolder::kStableV8Extras,
>>>                                gin::ArrayBufferAllocator::SharedInstance
>>> ());
>>>
>>> isolate_holder = new gin::IsolateHolder(
>>>   thread->task_runner(),
>>>   gin::IsolateHolder::AccessMode::kUseLocker);
>>> isolate_holder->isolate()->Enter();
>>>
>>> LOG(WARNING) << "MyProduct: created isolate holder";
>>>
>>> // return isolate pointer
>>> v8::Isolate* isolate = isolate_holder->isolate();
>>>
>>> It worked as-is in Aurora project (Qualcomm fork) and i'm completely
>>> lost why it does not work in pure Chromium.
>>>
>>
>> Is the V8 version the same in both? This check was added pretty recently.
>>
>>
>>> Any suggestion or pointing a direction would be extremely helpful.
>>>
>>> Also i've tried to create isolate instance in thread (see the code
>>> above) in order to put them in the same thread - no luck.
>>>
>>
>>
>> Not sure how to read your code snippet; does the code below the thread
>> creation happen inside the thread? Or this is the setup code for the thread
>> (which is ran in the main thread)?
>>
>
> The code above is invoked on main thread, invocation also comes on main
> thread (i'm 99.9% sure as i can see thread id in the log) so i expected
> DCHECK to be successful.
> Also it makes even more difficult as library that is using that Isolate
> instance is doing thread synchronization on it's own and probably it
> affects  Chromium's synchronizations too.
>
> It was extremely difficult to know what task is being invoked too.
> I've added v8_platform.cc in order to see when tasks scheduling happens
> and i can see some tasks are scheduled to be invoked on main thread and
> some on background.
>
>
>>
>>
>> --
>>
>>
>> Google Germany GmbH
>>
>> Erika-Mann-Straße 33
>> <https://maps.google.com/?q=Erika-Mann-Stra%C3%9Fe+33+80636+M%C3%BCnchen&entry=gmail&source=g>
>>
>> 80636 München
>> <https://maps.google.com/?q=Erika-Mann-Stra%C3%9Fe+33+80636+M%C3%BCnchen&entry=gmail&source=g>
>>
>> Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
>>
>> Registergericht und -nummer: Hamburg, HRB 86891
>>
>> Sitz der Gesellschaft: Hamburg
>>
>> Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten
>> haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter,
>> löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen,
>> dass die E-Mail an die falsche Person gesendet wurde.
>>
>>
>>
>> This e-mail is confidential. If you received this communication by
>> mistake, please don't forward it to anyone else, please erase all copies
>> and attachments, and please let me know that it has gone to the wrong
>> person.
>>
> --
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" 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/d/optout.
>



-- 


Google Germany GmbH

Erika-Mann-Straße 33

80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten
haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter,
löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen,
dass die E-Mail an die falsche Person gesendet wurde.



This e-mail is confidential. If you received this communication by mistake,
please don't forward it to anyone else, please erase all copies and
attachments, and please let me know that it has gone to the wrong person.

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" 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/d/optout.

Reply via email to