Exception in Isolate::Scope's destructor

182 views
Skip to first unread message

Nikolas Kovacs

unread,
Sep 8, 2024, 2:22:30 PM9/8/24
to v8-users
Hi,

I am upgrading the version of v8 I am embedding into my program. I am having an issue that I cannot figure out how to solve. The issue is that, when building in debug mode, the Isolate::Scope object's destructor throws the following exception.

```
Exception thrown: read access violation.
this was 0x21000000001.
```

For reference, I am on Windows 10 and I am using clang-cl and libc++ that is built with v8.
The following is my build arguments for building v8 from source

```
is_debug = true
v8_enable_verify_heap = false
v8_enable_single_generation = false
v8_enable_shared_ro_heap = true
v8_enable_webassembly = true
v8_enable_maglev = true
v8_enable_turbofan = true
v8_enable_debug_code = true
v8_enable_debugging_features = true
v8_enable_direct_handle = false
v8_enable_direct_local = false
v8_enable_disassember = true
target_cpu = "x64"
enable_iterator_debugging = true
v8_enable_slow_dchecks = false
v8_use_external_startup_data = false
v8_enable_sandbox = true
v8_enable_pointer_compression = true
v8_enable_pointer_compression_shared_cage = true
v8_enable_31bit_smis_on_64bit_arch = true
```

Below is a reproducible example:

```cpp
#include <v8.h>
#include <libplatform/libplatform.h>
#include <memory>

int main() {
    std::unique_ptr<v8::Platform> platform = v8::platform::NewDefaultPlatform();
    v8::V8::InitializePlatform(platform.get());
    v8::V8::Initialize();

    v8::Isolate::CreateParams create_params;
    create_params.array_buffer_allocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator();
    v8::Isolate* isolate = v8::Isolate::New(create_params);

    {
        v8::Isolate::Scope isolate_scope{ isolate };
        v8::HandleScope handle_scope{ isolate };
    }
    return 0;
}
```

Nikolas Kovacs

unread,
Sep 8, 2024, 2:33:47 PM9/8/24
to v8-users
This is using v8 12.7.224.18 503eb7e9a50b0211f8db54ea362ea06ef56c940d, but I also experienced it with 12.8.374.11 57fb77ac624960f08296dbba8ef5b82ab5184287

Ben Noordhuis

unread,
Sep 9, 2024, 3:46:48 AM9/9/24
to v8-u...@googlegroups.com
You build V8 with is_debug=true so make sure your own code is also
compiled with -DV8_ENABLE_CHECKS, otherwise there will be an ABI
mismatch between your code and V8's.

(I have a todo to create a CL that detects that but I haven't gotten
around to it yet.)

Nikolas Kovacs

unread,
Sep 9, 2024, 11:05:33 PM9/9/24
to v8-users

Much appreciated. This resolved my problem.
Reply all
Reply to author
Forward
0 new messages