We managed to restore the functionality as follows:

diff --git a/src/execution/stack-guard.cc b/src/execution/stack-guard.cc
index efcaf8cd10b..0e7cfbb704d 100644
--- a/src/execution/stack-guard.cc
+++ b/src/execution/stack-guard.cc
@@ -383,6 +385,8 @@ Tagged<Object> 
StackGuard::HandleInterrupts(InterruptLevel level) {
 
   isolate_->counters()->stack_interrupts()->Increment();
 
+  if (isolate_->has_exception()) return 
ReadOnlyRoots(isolate_).exception();
+
   return ReadOnlyRoots(isolate_).undefined_value();
 }
 
V8 team, please let us know if this is worth a PR. Thanks!
On Friday, January 19, 2024 at 12:15:58 PM UTC-5 ClearScript Developers 
wrote:

> Hello again!
>
> It turns out that, in 12.1, calling v8::Isolate::ThrowError from an 
> interrupt callback now causes a DCHECK_EQ failure in 
> v8::internal::Isolate::VerifyBuiltinsResult.
>
> We've compared the 11.8 and 12.1 code, and it looks like the difference 
> may have to do with scheduled exceptions vs. pending exceptions. That 
> distinction seems to have been removed in 12.1, and, as a result, calling 
> v8::Isolate::ThrowError from an interrupt callback is now a guaranteed 
> crash.
>
> Can someone confirm that? Is it a bug?
>
> Thanks!
>
> On Wednesday, January 17, 2024 at 11:15:36 AM UTC-5 ClearScript Developers 
> wrote:
>
>> Hello!
>>
>> Suppose a long-running script is periodically interrupted via 
>> v8::Isolate::RequestInterrupt. The interrupt callback can call 
>> v8::Isolate::TerminateExecution to stop the script forcefully.
>>
>> Is it "legal" for the callback to call v8::Isolate::ThrowError/Exception 
>> instead? That worked in 11.8, but 12.1 seems to lose the exception.
>>
>> Thanks!
>>
>

-- 
-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/88720360-6c01-4807-8d1f-4cf31b2cfc54n%40googlegroups.com.

Reply via email to