Core Dump in v8::Module::InstantiateModule() (V8 v9.6.180.12)

140 views
Skip to first unread message

Sam Cao

unread,
Nov 17, 2021, 10:16:17 PM11/17/21
to v8-...@googlegroups.com
Hi There,

I recently synced up to V8 v9.6.180.12, but met a core dump issue in v8::Module::InstantiateModule.

Symptom
  1. Register a custom module resolver.
  2. Prepare an invalid module referencing a non-existing module. E.g. import { a } from 'a.js'
  3. Call v8::ScriptCompiler::CompileModule() to compile that invalid module.
  4. In the custom module resolver, just return an empty module.
  5. v8::ScriptCompiler::CompileModule()  returns a MaybeLocal module.
  6. Call InstantiateModule() to initialize that module.
  7. A core dump occurs. The stack trace is as follows.
#
# Fatal error in , line 0
# Check failed: has_pending_exception().
#
#
#
#FailureMessage Object: 000000A0B96FB020
==== C stack trace ===============================
v8::base::debug::StackTrace::StackTrace [0x00007FF87FEA624B+27]
v8::platform::DefaultPlatform::GetStackTracePrinter [0x00007FF87FE01B07+55]
V8_Fatal [0x00007FF87FEAE389+217]
v8::internal::Isolate::PropagatePendingExceptionToExternalTryCatch [0x00007FF87FE64311+273]
v8::internal::Isolate::OptionalRescheduleException [0x00007FF87FE648D6+38]
v8::Module::InstantiateModule [0x00007FF87FE081DD+317]

Analysis

In V8 9.5 (and below), the behavior is InstantiateModule() returns without a core dump. So I reviewed the recent commits and found the following commit is suspicious.
62a557e Merged: [runtime] Check if we have a pending exception before returning it by Toon Verwaest
 
Then, I rolled back to v9.6.180.8 and the core dump issue was gone. I suspect the one line change CHECK(has_pending_exception()); somehow doesn't satisfy v8::Module::InstantiateModule(). Could you please check this out?
 Object Isolate::pending_exception() {
-  DCHECK(has_pending_exception());
+  CHECK(has_pending_exception());
   DCHECK(!thread_local_top()->pending_exception_.IsException(this));
   return thread_local_top()->pending_exception_;
 }

Thank you,
Sam Cao

Jakob Gruber

unread,
Nov 18, 2021, 1:55:04 AM11/18/21
to v8-...@googlegroups.com, Toon Verwaest

--
--
v8-dev mailing list
v8-...@googlegroups.com
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 v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/CADa8QzE3qgPfY5a8KGNrV%2BE_a%2BrZ43O5zERSbX8Q0McWD7TbQw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages