The Wayback Machine - https://web.archive.org/web/20220510114459/https://github.com/nodejs/node/discussions/42188
Skip to content

Embedder crashing at node::InitializeNodeWithArgs with C0000005 (access violation) on Windows #42188

Unanswered
giilbert asked this question in General
Embedder crashing at node::InitializeNodeWithArgs with C0000005 (access violation) on Windows #42188
Feb 28, 2022 · 1 answer

Version

v17.6.1-pre (built from source from https://github.com/nodejs/node/tree/v17.x-staging)

Platform

Microsoft Windows NT 10.0.19044.0 x64

Subsystem

No response

What steps will reproduce the bug?

I'm trying to build node into a static library and link it to a project with CMake.

  1. Build node from https://github.com/nodejs/node/tree/v17.x-staging with flags --fully-static & --enable-static. I used MS Build Tools 2019.
  2. Build the embedding example with options:
  • Compiler flags: MT
  • Definitions: DV8_COMPRESS_POINTERS, D_ITERATOR_DEBUG_LEVEL=0
  • Includes: v8, node, uv
  • Linking: v8_monolith.lib (v 9.9-lkgr), node.lib (v17.x-staging), dbghelp.lib, Winmm.lib
  • Link options: /ignore:4099
  1. Build with CMake with no issue! Put a copy of node.exe generated during the build at the output directory and run it test.exe console.log(42).
  2. Crashes with exit code -1073741819 [hex C0000005]

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

The program would not crash and 42 gets outputted to the console.

What do you see instead?

  • Program silently crashes with exit code -1073741819 [hex C0000005] (access violation).
  • It doesn't make it to the error handling after node::InitializeNodeWithArgs.

Using the debugger, I found that it crashes at

int exit_code = node::InitializeNodeWithArgs(&args, &exec_args, &errors);

with Exception 0xc0000005 encountered at address 0x51dfefe: User-mode data execution prevention (DEP) violation at location 0x051dfefe
-858993460 also got stored in exit_code variable

Did I build node wrong? If so, how do I build it into a .lib correctly?

Additional information

CMakeLists.txt - https://gist.github.com/giilbert/db130af69dce695af2f40fb83c87352e

Replies

1 suggested answer

I've converted this to a discussion because this is likely not a bug in node.js itself.

0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows embedding
2 participants
Converted from issue
Morty Proxy This is a proxified and sanitized view of the page, visit original site.