-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Hi there,
When I run software under Electron or PKG that runs bcrypto with native bindings on Windows, I get a "DLL Initialization Routine Failed" error. The error looks like this:
Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\Users\Matthew Slipper\IdeaProjects\hsd\node_modules\bcrypto\build\Release\bcrypto.node
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1186:18)
at Module.load (internal/modules/cjs/loader.js:984:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1024:19)
at Module.require (pkg/prelude/bootstrap.js:1225:31)
at require (internal/modules/cjs/helpers.js:72:18)
at bindings (C:\snapshot\hsd\node_modules\loady\lib\loady.js:98:17)
at Object.<anonymous> (C:\snapshot\hsd\node_modules\bcrypto\lib\native\binding.js:14:33)
at Module._compile (pkg/prelude/bootstrap.js:1320:22)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1156:10)
I've already verified that the Node ABI version in use is correct. After attaching WinDBG to the PKG-generated process, I see the following error:
ModLoad: 00007ffe`4a130000 00007ffe`4a23e000 \\?\C:\Users\Matthew Slipper\IdeaProjects\hsd\node_modules\bdb\build\Release\leveldown.node
ModLoad: 00007ffe`409d0000 00007ffe`40b1a000 \\?\C:\Users\Matthew Slipper\IdeaProjects\hsd\node_modules\bcrypto\build\Release\bcrypto.node
ModLoad: 00007ffe`8c4b0000 00007ffe`8c4c7000 C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll
ModLoad: 00007ff7`12a80000 00007ff7`1499f000 C:\Program Files\nodejs\node.exe
(436c.1a2c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
(Note: The exception is not handled, since WinDBG goes into a loop after stepping over the exception.)
The error is the same when I debug Bob in the same way. Error code c0000005 isn't a missing DLL error, it implies a runtime bug within bcrypto itself that is triggering a memory access violation. Any chance you could take a look and see what is going on? Being able to bundle HSD via PKG would dramatically simplify Bob development, and allow people to make standalone HSD binaries in the future.
The issue is not present when HSD is run from my system Nodejs interpreter. The error disappears when I set process.env.NODE_BACKEND to js.