Search code examples
node.jsv8

NodeJS error initializing V8 on Gentoo AMD64


I managed to compile V8 engine on the machine, however when I type

$ node

FATAL ERROR: v8::Debug::SetDebugMessageDispatchHandler Error initializing V8

I have V8 version 3.6.6.11, the D8 console is working properly. I've tried portage version of nodejs 0.6.6, compiled version from github shows the same error. I guess the problem is with heap of stack allocation

$ ulimit -a

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31707
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31707
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

It is a virtual machine, that might raise some limitations...

Linux 2.6.36-hardened-r9-guest-hardened-01 x86_64 QEMU Virtual CPU version 0.13.0 AuthenticAMD GNU/Linux Any ideas?


Solution

  • after debuggin nodejs with Vyacheslav Egorov we found out, that mmap is failing to allocate memory (Operation not permitted) - this is caused by some Gentoo's security flag (changing it might require to recompile kernel)

    Finally I used node v0.6 branch from github

    ./configure --without-snapshot
    make
    make install
    

    and

    paxctl -m /usr/local/bin/node
    

    which adds MPROTECT flag

    - PaX flags: -----m-x-e-- [/usr/local/bin/node]
            MPROTECT is disabled
            RANDEXEC is disabled
            EMUTRAMP is disabled
    

    Note to myself:

    when running Rails application on server put to config/boot.rb

    ENV['EXECJS_RUNTIME'] = 'Node' if ENV['RAILS_ENV'] == 'production'