I recently synced up to V8 v9.6.180.12, but met a core dump issue in v8::Module::InstantiateModule.
Symptom- Register a custom module resolver.
- Prepare an invalid module referencing a non-existing module. E.g. import { a } from 'a.js'.
- Call v8::ScriptCompiler::CompileModule() to compile that invalid module.
- In the custom module resolver, just return an empty module.
- v8::ScriptCompiler::CompileModule() returns a MaybeLocal module.
- Call InstantiateModule() to initialize that module.
- 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,