开发者

nodejs-0.4.2 segfault on start (Fixed in v 0.4.5)

Greetings, to save your time this bug was fixed in v0.4.5 I ran into a rather weird problem while installing node.js today and sifted through the mail archives but couldn't quite pin it!. so I posted the problem to nodejs here

just a heads up that I changed snapshot='snapshot=on' from wscript in Node to snapshot=''. I did this because prior to doing this I encountered the following error during make:

scons: *** [obj/release/snapshot.cc] Error -11

Now to the steps I followed.

*logged in as root

---Start of configure

adil-X:/usr/local/nodejs/node-v0.4.2 # ./configure --prefix=/usr/local/nodejs    
Checking for program g++ or c++          : /usr/bin/g++    
Checking for program cpp                 : /usr/bin/cpp    
Checking for program ar                  : /usr/bin/ar    
Checking for program ranlib              : /usr/bin/ranlib    
Checking for g++                         : ok    
Checking for program gcc or cc           : /usr/bin/gcc    
Checking for program ar                  : /usr/bin/ar    
Checking for program ranlib              : /usr/bin/ranlib    
Checking for gcc                         : ok    
Checking for library dl                  : yes    
Checking for openssl                     : yes    
Checking for library util                : yes    
Checking for library rt                  : yes    
--- libeio ---    
Checking for library pthread             : yes    
Checking for function pthread_create     : yes    
Checking for function pthread_atfork     : yes    
Checking for futimes(2)                  : yes    
Checking for readahead(2)                : yes    
Checking for fdatasync(2)                : yes    
Checking for pread(2) and pwrite(2)      : yes    
Checking for sendfile(2)                 : yes    
Checking for sync_file_range(2)          : yes    
--- libev ---    
Checking for header sys/inotify.h        : yes
Checking for function inotify_init       : yes    
Checking for header sys/epoll.h          : yes    
Checking for function epoll开发者_StackOverflow中文版_ctl          : yes    
Checking for header port.h               : not found    
Checking for header poll.h               : yes    
Checking for function poll               : yes    
Checking for header sys/event.h          : not found    
Checking for header sys/queue.h          : yes    
Checking for function kqueue             : not found    
Checking for header sys/select.h         : yes    
Checking for function select             : yes    
Checking for header sys/eventfd.h        : yes    
Checking for function eventfd            : yes    
Checking for SYS_clock_gettime           : yes    
Checking for library rt                  : yes    
Checking for function clock_gettime      : yes    
Checking for function nanosleep          : yes    
Checking for function ceil               : yes    
Checking for fdatasync(2) with c++       : yes    
'configure' finished successfully (2.239s)

----End of configure

----Start of make(this compiles fine!!)

[make output omitted for brevity]

Waf: Leaving directory /usr/local/nodejs/node-v0.4.2/build'

'build' finished successfully (21.853s)

-----End of make

-----Start of make test

/usr/bin/python "/usr/local/nodejs/node-v0.4.2/tools/scons/scons.py" -
j 2 -C "/usr/local/nodejs/node-v0.4.2/build/default/" -Y "/usr/local/
nodejs/node-v0.4.2/deps/v8" visibility=default mode=release arch=ia32
toolchain=gcc library=static

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: `library' is up to date.
scons: done building targets.
DEST_OS: linux
DEST_CPU: ia32
Parallel Jobs: 2

Product type: program
python tools/test.py --mode=release simple message
[00:00|%   0|+   0|-   0]: release test-pipe-
head                                                  === release test-
pipe-head ===
Path: simple/test-pipe-head
Command: build/default/node /usr/local/nodejs/node-v0.4.2/test/simple/
test-pipe-head.js
--- CRASHED ---

... All of the subsequent tests fail in a similar fashion.

-----End of make test

-----Start of make install (I did not execute make test on the first few tries.it was only later that I used it)

adil-X:/usr/local/nodejs/node-v0.4.2 # make install

Waf: Entering directory `/usr/local/nodejs/node-v0.4.2/build'
DEST_OS: linux
DEST_CPU: ia32
Parallel Jobs: 2
Product type: program
* installing build/default/config.h as /usr/local/nodejs/include/node/
config.h
* installing build/default/tools/nodejs.pc as /usr/local/nodejs/lib/
pkgconfig/nodejs.pc
* installing build/default/node as /usr/local/nodejs/bin/node
* installing build/default/src/node_config.h as /usr/local/nodejs/
include/node/node_config.h
Waf: Leaving directory `/usr/local/nodejs/node-v0.4.2/build'
'install' finished successfully (0.122s)

-----End of make install

I updated the PATH variable to include the nodejs bin.

Now nodejs crashes with following error on startup

adil-X:/usr/local/nodejs/node-v0.4.2 # node example.js

node.js:0
Segmentation fault

still, I can see the node.js version

adil-X:~ # node -v
v0.4.2

OS/Arch info:

adil-X:~ # cat /etc/*release
LSB_VERSION="core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-
ia32:core-3.2-ia32:core-4.0-ia32"
openSUSE 11.3 (i586)

adil-X:~ # cat /proc/cpuinfo
vendor_id    :GenuineIntel
cpu family    : 6
model          : 23
model name  : Intel(R) Core(TM)2 Duo CPU     T6500  @ 2.10GHz
stepping       : 10
cpu MHz       : 1200.000
cache size     : 2048 KB

With no errors on the way when building from source, I am unable to figure out the problem. am I missing something obvious? thanks.


There's a few mechanisms I can suggest to try to track down this problem.

First, use strace(1) and ltrace(1) on nodejs:

strace -o /tmp/node.strace -fF nodejs script.js
ltrace -o /tmp/node.ltrace -f nodejs script.js

Then look through the /tmp/node.* files to discover what it was doing moments before it crashed. Edit: strace(1) reports the system calls that the program makes; as programs interact with the outside world via system calls, it's often the fastest mechanism to finding bugs. ltrace(1) reports dynamic library calls, which is frequently a lot more information about the internal workings of the program. Both are useful.

Second, run dmesg > /tmp/dmesg and look through the dmesg output for the segfault information, it'll look like this:

[332430.652393] npviewer.bin[13508]: segfault at 418 ip 00000000f6086d16 sp 00000000ffd8b018 error 6 in libflashplayer.so[f5e19000+b5f000]

That's an Adobe Flash crash; comparing the addresses against readelf -s output on the program, you might be able to guess how far into the function the segfault is occurring, which might help when reading the source code. (It's a long shot to guess by address how far you are into a function, but I've found it useful to know if I should look near the start or end of a function.)

Third, you could run the program with valgrind(1):

valgrind nodejs script.js

Valgrind is an impressive tool that might require a fair amount of learning to really know. The little I've used it, I've been impressed, but I can't give as decent a guide as the other simpler tools.

Fourth, you could run nodejs under gdb:

gdb --args nodejs script.js

When it dies, run bt to get a backtrace. gdb is also an impressive program, and you could probably find the exact line that fails using it, but it too takes a fair amount of learning to really know. I've been lucky enough that backtraces were usually enough to find the fault.

With luck you'll be pointed to the exact function that failed, and ltrace(1) will give you the arguments of that function. This'll hopefully be enough to track down the specific bug.


problem fixed in nodejs-v0.4.5.no hassle at all. Maybe there was really a bug in nodejs-v0.4.2 afterall.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜