Closed kckeiks closed 1 month ago
V8 contains a thread-local variable referring to the "current" isolate. When one handle_connection
task suspends, another one can run, but the current isolate thread-local variable is not updated. You can call Isolate::enter
/exit
to update this variable.
deno_core
, which it looks like you are using, is probably going to struggle in this regard because it assumes one runtime per thread, and so it doesn't include calls to handle this enter/exit stuff.
Hi,
We have an app that is more or less doing the following:
!Send
).JsRuntime
instance per request so consequently a thread could create more than oneJsRuntime
instance.Pseudo code:
When we send multiple requests in parallel to our app, we hit the assertion
v8::OwnedIsolate instances must be dropped in the reverse order of creation.
Could you please advise on how we could be causing isolates to drop out of order? Do you have any suggestions on how to better use your API to solve our problem?Thanks in advance.