+ricea@ On Wed, Nov 7, 2018 at 6:44 PM Yuki Shiino <yukishi...@chromium.org> wrote:
> Hi V8-team and platform-architecture-dev, > > TL;DR: We'd like to extend v8::TryCatch APIs a little. > > We're having an issue how to handle worker termination, i.e. v8::Isolate > termination. Roughly speaking, the situation is like below. > > Main thread: > v8::Isolate* worker_isolate = ...; > worker_isolate->TerminateExecution(); // Terminates the worker > isolate. > > Worker thread (worker isolate): > v8::TryCatch try_catch(isolate); > DoSomethingWithV8(); // The Isolate terminates here. > if (try_catch.HasCaught()) { // => true due to termination > // Handle error or termination. > return; > } > > No problem so far. Worker thread MUST NOT run any V8 code no longer > because the Isolate is terminating. However, Blink is not perfect, and > it's pretty tough for Blink to stop everything with 100% correctness. > Occasionally (or rarely) Blink continues running more V8 code like below. > > Worker thread (worker isolate): > v8::TryCatch try_catch(isolate); > DoSomethingElseWithV8(); > if (try_catch.HasCaught()) { // => false because no new exception is > thrown inside the v8::TryCatch. > return; // Blink doesn't reach here. > } > // Blink reach here instead. :( > > If v8::TryCatch::HasCaught() returned true, Blink would be able to handle > it as error and Blink would work much better than now (Blink is now > crashing). > > So, proposals here are something like below (not yet so concrete). > > a) Make v8::TryCatch::HasCaught() return true if there already exists a > pending exception. (Maybe this is no good.) > b) Make a new API like v8::TryCatch::HasPendingException() and make it > return true. Blink rewrites all HasCaught() to the new one. > > Similarly, > > a2) Make v8::TryCatch::Exception() return a pending exception if there > already exists. > b2) Make a new API like v8::TryCatch::PendingException() and make it > return a thrown exception or pending exception in the isolate if any. > Blink rewrites all Exception() to the new one. > > What do you think of the issue and proposals? > > Cheers, > Yuki Shiino > > -- -- 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.