On Sat, May 12, 2018 at 1:20 AM, Jérôme Gravel-Niquet <jer...@fly.io> wrote:
> Another fiber might call v8_with_ctx_scope() again before the first call to
> it is done. With the same context. When I added a mutex, the problem seemed
> fixed. I just want to make sure this is limitation: you can't enter the same
> context more than one at the same time, or else exiting will exit from both
> "enters".

Yes, another fiber calling v8_with_ctx_scope() is what I mean.

Entering and exiting the same context more than once should be okay.
When Crystal switches fibers, I assume it switches stack and registers
but does it also switch thread-local storage?  That might explain why
you're hitting that check, V8 stores state in thread-local storage.

> Hmm. It's called into when there's an HTTP request coming in or when there's
> a callback fired (like a setTimeout.)
>
> Not entirely sure what kind of information you're looking for :) There's
> probably going to be frames on the call stack.

Okay, that might also be a factor.  I don't think you're supposed to
exit the context when there are stack frames under you that belong to
that context.  I.e.:

  enter context -> call JS -> JS calls C++ -> exit context  -- not good

Is there code I can look at or try out?

-- 
-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to