laverdet / isolated-vm

Secure & isolated JS environments for nodejs
ISC License
2.16k stars 152 forks source link

Test failed with WSL ubuntu 16 + Node v14.16.1 #249

Open tigercosmos opened 3 years ago

tigercosmos commented 3 years ago
npm install
npm test

then all test cases get the same error:

exception-info.js: *fail*
code: null signal: SIGABRT
stderr: node: ../src/lib/suspend.h:32: ivm::thread_suspend_handle::initialize::initialize(): Assertion `sigaction(SIGRTMIN, &handler, nullptr) == 0' failed.

any clues?

laverdet commented 3 years ago

Hmm WSL is a really wonky environment. Can you try in CMD and let me know if it works? I may have to modify or disable this particular feature on WSL

haynajjar commented 3 years ago

Any update on this issue ?

GramThanos commented 1 year ago

It seems that the sigaction struct is not initialised properly. One can patch the code located at node_modules\isolated-vm\src\lib\suspend.h, adding the code memset(&handler, '\0', sizeof(handler)); just after struct sigaction handler; (line 29).

Patched code:

        struct initialize {
            initialize() {
                // Set process-wide signal handler
                struct sigaction handler;
                memset(&handler, '\0', sizeof(handler));
                handler.sa_handler = callback;
                sigemptyset(&handler.sa_mask);
                assert(sigaction(SIGRTMIN, &handler, nullptr) == 0);
            }
        };

Then one should run npm run rebuild while inside node_modules\isolated-vm to rebuild the code.