Re: [nodejs] npm got Segmentation fault at linux (npm 1.1.48 & node v0.8.6)

1,997 views
Skip to first unread message

Ben Noordhuis

unread,
Aug 13, 2012, 8:19:50 AM8/13/12
to nod...@googlegroups.com
On Mon, Aug 13, 2012 at 11:42 AM, TZ <ati...@qq.com> wrote:
>
> http://stackoverflow.com/questions/11895623/npm-got-segmentation-fault-at-linux
>
> linux version:
>
> [root@etone231 download]# lsb_release -a
> LSB Version:
> :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
> Distributor ID: RedHatEnterpriseServer
> Description: Red Hat Enterprise Linux Server release 5.1 (Tikanga)
> Release: 5.1
> Codename: Tikanga
>
> node.js:
>
> git clone https://github.com/joyent/node.git
> cd node
> ./configure
> make
> sudo make install
>
> npm fail:
>
> [root@etone231 download]# node -e "console.log('a')"
> a
>
> [root@etone231 download]# node -v
> v0.8.6
>
> [root@etone231 download]# python -V
> Python 2.7.3
>
> [root@etone231 download]# gmake -v
> GNU Make 3.81
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.
> There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
> PARTICULAR PURPOSE.
>
> This program built for x86_64-redhat-linux-gnu
>
> [root@etone231 download]# npm -v
> 1.1.48
>
> [root@etone231 download]# npm list
> Segmentation fault

Try this:

$ gdb --args npm list
> run
# wait for crash
> backtrace full
# post the backtrace

By the way, you have more than one node binary installed. The GH repo
builds v0.9.1-pre but `node -v` reports v0.8.6.

TZ

unread,
Aug 13, 2012, 9:31:13 PM8/13/12
to nod...@googlegroups.com
I'v try again, uninstall everything.
then, "git checkout v0.8.6" before make
but still got the same error.

had follow your step:
[root@etone231 opt]# gdb --args npm  
GNU gdb Red Hat Linux (6.5-25.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"..."/usr/local/bin/npm": not in executable format: File format not recognized

(gdb) run
Starting program:  
No executable file specified.
Use the "file" or "exec-file" command.
(gdb) backtrace full
No stack.
(gdb) 

[root@etone231 opt]# ll /usr/local/bin/npm
lrwxrwxrwx 1 root root 38 Aug 14 09:14 /usr/local/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js


在 2012年8月13日星期一UTC+8下午8时19分50秒,Ben Noordhuis写道:

Mihamina Rakotomandimby

unread,
Aug 14, 2012, 12:15:11 AM8/14/12
to nod...@googlegroups.com
On 08/14/2012 04:31 AM, TZ wrote:
> [root@etone231 opt]# gdb --args npm

Re-read carefully.

He told you:
gdb --args npm list




--
RMA.

Ben Noordhuis

unread,
Aug 14, 2012, 5:58:02 AM8/14/12
to nod...@googlegroups.com
And if that doesn't work, try `gdb --args node npm list`

TZ

unread,
Aug 14, 2012, 7:10:47 AM8/14/12
to nod...@googlegroups.com
had try ' gdb --args npm' and ' gdb --args npm list' , the same error. "No executable file specified."
and when exec npm at shell, still got sementation fault.

在 2012年8月14日星期二UTC+8下午12时15分11秒,Mihamina Rakotomandimby写道:

TZ

unread,
Aug 14, 2012, 9:37:05 PM8/14/12
to nod...@googlegroups.com
[root@etone46 opt]# pwd     
/opt
[root@etone46 opt]# gdb --args node npm list
GNU gdb Red Hat Linux (6.5-25.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/libthread_db.so.1".

(gdb) run
Starting program: /usr/local/bin/node npm list
[Thread debugging using libthread_db enabled]
[New Thread 46912496273456 (LWP 8690)]
[New Thread 1073809728 (LWP 8693)]

module.js:340
    throw err;
          ^
Error: Cannot find module '/opt/npm'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Program exited with code 01.
(gdb) backtrace full 
No stack.
(gdb) 
[2]+  Stopped                 gdb --args node npm list
[root@etone46 opt]# which npm
/usr/local/bin/npm
[root@etone46 opt]# ll /usr/local/bin/npm 
lrwxrwxrwx 1 root root 38 Aug 14 09:14 /usr/local/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js


在 2012年8月14日星期二UTC+8下午5时58分02秒,Ben Noordhuis写道:

Nathan Rajlich

unread,
Aug 14, 2012, 9:44:16 PM8/14/12
to nod...@googlegroups.com
Try it like:

gdb --args node `which npm` list
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

TZ

unread,
Aug 14, 2012, 10:22:32 PM8/14/12
to nod...@googlegroups.com
[root@etone46 ~]# gdb --args node `which npm` list
GNU gdb Red Hat Linux (6.5-25.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/libthread_db.so.1".

(gdb) run
Starting program: /usr/local/bin/node /usr/local/bin/npm list
[Thread debugging using libthread_db enabled]
[New Thread 46912496273456 (LWP 9663)]
[New Thread 1073809728 (LWP 9666)]
[New Thread 1074075968 (LWP 9667)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1074075968 (LWP 9667)]
0x00000000005d4d3d in uv_async_send (handle=0xe02368)
    at ../deps/uv/src/unix/async.c:56
56      ../deps/uv/src/unix/async.c: No such file or directory.
        in ../deps/uv/src/unix/async.c
(gdb) backtrace full
#0  0x00000000005d4d3d in uv_async_send (handle=0xe02368)
    at ../deps/uv/src/unix/async.c:56
No locals.
#1  0x00000000005d6baf in etp_proc (thr_arg=<value optimized out>)
    at ../deps/uv/src/unix/eio/eio.c:2094
        req = (eio_req *) 0x17948510
        ts = {tv_sec = 0, tv_nsec = 46874976}
        self = (etp_worker *) 0x17980030
#2  0x00000037080062e7 in start_thread () from /lib64/libpthread.so.0
No symbol table info available.
#3  0x00000037074ce3bd in clone () from /lib64/libc.so.6
No symbol table info available.

在 2012年8月15日星期三UTC+8上午9时44分16秒,Nathan Rajlich写道:

TZ

unread,
Aug 16, 2012, 4:51:32 AM8/16/12
to nod...@googlegroups.com
RedHat5 ,  glibc version is 2.5
is that matter?

在 2012年8月15日星期三UTC+8上午10时22分32秒,TZ写道:

Ben Noordhuis

unread,
Aug 16, 2012, 8:01:09 AM8/16/12
to nod...@googlegroups.com
On Thu, Aug 16, 2012 at 10:51 AM, TZ <ati...@qq.com> wrote:
> RedHat5 , glibc version is 2.5
> is that matter?

No, it shouldn't matter (though I don't test against 2.5 often - or
linux 2.6.18 for that matter).

Can you try the following:

$ cd path/to/node
$ make -j 8 BUILDTYPE=Debug # 8 == number of CPUs
$ gdb --args out/Debug/node /usr/local/bin/npm list
> run
# wait for the crash
> thread apply all backtrace full

That should produce a (hopefully) more enlightening backtrace.

TZ

unread,
Aug 16, 2012, 9:24:32 AM8/16/12
to nod...@googlegroups.com

this means 2 or 4 cpu?  but set make -j 2 and make -j 4 got the same error

[root@etone46 node]# grep processor /proc/cpuinfo
processor : 0
processor : 1
processor : 2
processor : 3

[root@etone46 node]# make -j 4 BUILDTYPE=Debug
make -C out BUILDTYPE=Release V=1
make -C out BUILDTYPE=Debug V=1
make[1]: Entering directory `/opt/download/nodejs/node/out'
make[1]: Entering directory `/opt/download/nodejs/node/out'
  g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DNODE_WANT_INTERNALS=1' '-DARCH="x64"' '-DPLATFORM="linux"' '-DHAVE_OPENSSL=1' '-D__POSIX__' '-DDEBUG' '-D_DEBUG' -I../src -I../deps/uv/src/ares -I/opt/download/nodejs/node/out/Debug/obj/gen -I../deps/http_parser -I../deps/uv/include -I../deps/openssl/openssl/include -I../deps/openssl/config/k8 -I../deps/v8/include -I../deps/zlib  -Wall -pthread -m64 -g -O0 -fno-rtti -fno-exceptions -MMD -MF /opt/download/nodejs/node/out/Debug/.deps//opt/download/nodejs/node/out/Debug/obj.target/node/src/node.o.d.raw  -c -o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node.o ../src/node.cc
  g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DNODE_WANT_INTERNALS=1' '-DARCH="x64"' '-DPLATFORM="linux"' '-DHAVE_OPENSSL=1' '-D__POSIX__' -I../src -I../deps/uv/src/ares -I/opt/download/nodejs/node/out/Release/obj/gen -I../deps/http_parser -I../deps/uv/include -I../deps/openssl/openssl/include -I../deps/openssl/config/k8 -I../deps/v8/include -I../deps/zlib  -Wall -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-rtti -fno-exceptions -MMD -MF /opt/download/nodejs/node/out/Release/.deps//opt/download/nodejs/node/out/Release/obj.target/node/src/node.o.d.raw  -c -o /opt/download/nodejs/node/out/Release/obj.target/node/src/node.o ../src/node.cc
  g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DNODE_WANT_INTERNALS=1' '-DARCH="x64"' '-DPLATFORM="linux"' '-DHAVE_OPENSSL=1' '-D__POSIX__' '-DDEBUG' '-D_DEBUG' -I../src -I../deps/uv/src/ares -I/opt/download/nodejs/node/out/Debug/obj/gen -I../deps/http_parser -I../deps/uv/include -I../deps/openssl/openssl/include -I../deps/openssl/config/k8 -I../deps/v8/include -I../deps/zlib  -Wall -pthread -m64 -g -O0 -fno-rtti -fno-exceptions -MMD -MF /opt/download/nodejs/node/out/Debug/.deps//opt/download/nodejs/node/out/Debug/obj.target/node/src/node_extensions.o.d.raw  -c -o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_extensions.o ../src/node_extensions.cc
  g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DNODE_WANT_INTERNALS=1' '-DARCH="x64"' '-DPLATFORM="linux"' '-DHAVE_OPENSSL=1' '-D__POSIX__' -I../src -I../deps/uv/src/ares -I/opt/download/nodejs/node/out/Release/obj/gen -I../deps/http_parser -I../deps/uv/include -I../deps/openssl/openssl/include -I../deps/openssl/config/k8 -I../deps/v8/include -I../deps/zlib  -Wall -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-rtti -fno-exceptions -MMD -MF /opt/download/nodejs/node/out/Release/.deps//opt/download/nodejs/node/out/Release/obj.target/node/src/node_extensions.o.d.raw  -c -o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_extensions.o ../src/node_extensions.cc
../src/node.cc: In function 'void node::DebugPortSetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&)':
../src/node.cc:2152: warning: converting to 'int' from 'double'
../src/node.cc: In function 'void node::DebugPortSetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&)':
../src/node.cc:2152: warning: converting to 'int' from 'double'
  flock /opt/download/nodejs/node/out/Debug/linker.lock g++ -pthread -rdynamic -m64  -o /opt/download/nodejs/node/out/Debug/node -Wl,--start-group /opt/download/nodejs/node/out/Debug/obj.target/node/src/fs_event_wrap.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/cares_wrap.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/handle_wrap.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_buffer.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_constants.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_extensions.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_file.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_http_parser.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_javascript.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_main.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_os.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_script.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_stat_watcher.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_string.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_zlib.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/pipe_wrap.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/stream_wrap.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/slab_allocator.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/tcp_wrap.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/timer_wrap.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/tty_wrap.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/process_wrap.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/v8_typed_array.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/udp_wrap.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_crypto.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_signal_watcher.o /opt/download/nodejs/node/out/Debug/obj.target/node/src/node_io_watcher.o /opt/download/nodejs/node/out/Debug/obj.target/deps/http_parser/libhttp_parser.a /opt/download/nodejs/node/out/Debug/obj.target/deps/uv/libuv.a /opt/download/nodejs/node/out/Debug/obj.target/deps/openssl/libopenssl.a /opt/download/nodejs/node/out/Debug/obj.target/deps/zlib/libchrome_zlib.a /opt/download/nodejs/node/out/Debug/obj.target/deps/v8/tools/gyp/libv8_base.a /opt/download/nodejs/node/out/Debug/obj.target/deps/v8/tools/gyp/libv8_snapshot.a -Wl,--end-group -lrt -ldl
  flock /opt/download/nodejs/node/out/Release/linker.lock g++ -pthread -rdynamic -m64  -o /opt/download/nodejs/node/out/Release/node -Wl,--start-group /opt/download/nodejs/node/out/Release/obj.target/node/src/fs_event_wrap.o /opt/download/nodejs/node/out/Release/obj.target/node/src/cares_wrap.o /opt/download/nodejs/node/out/Release/obj.target/node/src/handle_wrap.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_buffer.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_constants.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_extensions.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_file.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_http_parser.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_javascript.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_main.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_os.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_script.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_stat_watcher.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_string.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_zlib.o /opt/download/nodejs/node/out/Release/obj.target/node/src/pipe_wrap.o /opt/download/nodejs/node/out/Release/obj.target/node/src/stream_wrap.o /opt/download/nodejs/node/out/Release/obj.target/node/src/slab_allocator.o /opt/download/nodejs/node/out/Release/obj.target/node/src/tcp_wrap.o /opt/download/nodejs/node/out/Release/obj.target/node/src/timer_wrap.o /opt/download/nodejs/node/out/Release/obj.target/node/src/tty_wrap.o /opt/download/nodejs/node/out/Release/obj.target/node/src/process_wrap.o /opt/download/nodejs/node/out/Release/obj.target/node/src/v8_typed_array.o /opt/download/nodejs/node/out/Release/obj.target/node/src/udp_wrap.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_crypto.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_signal_watcher.o /opt/download/nodejs/node/out/Release/obj.target/node/src/node_io_watcher.o /opt/download/nodejs/node/out/Release/obj.target/deps/http_parser/libhttp_parser.a /opt/download/nodejs/node/out/Release/obj.target/deps/uv/libuv.a /opt/download/nodejs/node/out/Release/obj.target/deps/openssl/libopenssl.a /opt/download/nodejs/node/out/Release/obj.target/deps/zlib/libchrome_zlib.a /opt/download/nodejs/node/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a /opt/download/nodejs/node/out/Release/obj.target/deps/v8/tools/gyp/libv8_snapshot.a -Wl,--end-group -lrt -ldl
/opt/download/nodejs/node/out/Release/obj.target/deps/uv/libuv.a(eio.o): In function `eio__sync_file_range':
/opt/download/nodejs/node/out/../deps/uv/src/unix/eio/eio.c:1095: undefined reference to `sync_file_range'
collect2: ld returned 1 exit status
make[1]: *** [/opt/download/nodejs/node/out/Release/node] Error 1
make[1]: Leaving directory `/opt/download/nodejs/node/out'
make: *** [node] Error 2
make: *** Waiting for unfinished jobs....
/opt/download/nodejs/node/out/Debug/obj.target/deps/uv/libuv.a(eio.o): In function `eio__sync_file_range':
/opt/download/nodejs/node/out/../deps/uv/src/unix/eio/eio.c:1095: undefined reference to `sync_file_range'
collect2: ld returned 1 exit status
make[1]: *** [/opt/download/nodejs/node/out/Debug/node] Error 1
make[1]: Leaving directory `/opt/download/nodejs/node/out'
make: *** [node_g] Error 2


在 2012年8月16日星期四UTC+8下午8时01分09秒,Ben Noordhuis写道:

Ben Noordhuis

unread,
Aug 16, 2012, 9:42:52 AM8/16/12
to nod...@googlegroups.com
How did you manage to compile node the first time around? Anyway,
apply the patch below and recompile:

diff --git a/deps/uv/src/unix/eio/config_linux.h
b/deps/uv/src/unix/eio/config_linux.h
index e7a0d6e..9d00887 100644
--- a/deps/uv/src/unix/eio/config_linux.h
+++ b/deps/uv/src/unix/eio/config_linux.h
@@ -43,12 +43,7 @@
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

-/* sync_file_range(2) is available if kernel >= 2.6.17 and glibc >= 2.6 */
-#if LINUX_VERSION_CODE >= 0x020611 && __GLIBC_PREREQ(2, 6)
-#define HAVE_SYNC_FILE_RANGE 1
-#else
#define HAVE_SYNC_FILE_RANGE 0
-#endif

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

TZ

unread,
Aug 16, 2012, 10:33:27 AM8/16/12
to nod...@googlegroups.com
it's stranger,  I had make v0.8.7 success this morning... (the only thing I do is make glibc2.9 and install to /usr/local/glibc2.9)

sorry, could you show me a gist that I can download.
I don't know much about the patch format.
I save the patch you showed to 1.patch, then  cd /path/to/node && git apply 1.patch
got error: fatal: corrupt patch at line 15

在 2012年8月16日星期四UTC+8下午9时42分52秒,Ben Noordhuis写道:

Ben Noordhuis

unread,
Aug 16, 2012, 11:27:59 AM8/16/12
to nod...@googlegroups.com
On Thu, Aug 16, 2012 at 4:33 PM, TZ <ati...@qq.com> wrote:
> it's stranger, I had make v0.8.7 success this morning... (the only thing I
> do is make glibc2.9 and install to /usr/local/glibc2.9)
>
> sorry, could you show me a gist that I can download.
> I don't know much about the patch format.
> I save the patch you showed to 1.patch, then cd /path/to/node && git apply
> 1.patch
> got error: fatal: corrupt patch at line 15

Here you go:

https://gist.github.com/541ec1ce6e67d6ede2b0

TZ

unread,
Aug 16, 2012, 11:39:04 AM8/16/12
to nod...@googlegroups.com
thanks, here is the output: https://gist.github.com/3371148

在 2012年8月16日星期四UTC+8下午11时27分59秒,Ben Noordhuis写道:

Ben Noordhuis

unread,
Aug 17, 2012, 5:35:54 AM8/17/12
to nod...@googlegroups.com
On Thu, Aug 16, 2012 at 5:39 PM, TZ <ati...@qq.com> wrote:
> thanks, here is the output: https://gist.github.com/3371148

Interesting. If you upload the core file and the binary somewhere,
I'll take a look at it. You can generate a core from inside gdb with
the gcore command (`help gcore`).

TZ (天猪)

unread,
Aug 17, 2012, 9:58:12 AM8/17/12
to nod...@googlegroups.com
HI, I found some step maybe miss. 
the 'gdb --args out/Debug/node /usr/local/bin/npm list' don't run the new npm just make, but the old.

so I redo with following:
(sorry, I know nth about c & gdb)

  $ cd path/to/node 
  $ make -j 4 BUILDTYPE=Debug # 4 == number of CPUs 
  $ make install  # now /user/local/bin/npm -v is 1.1.49
  $ gdb --args out/Debug/node /usr/local/bin/npm list 
  > run 
  # wait for the crash 
  > thread apply all backtrace full 
  > help gcore
  > generate-core-file  # need this to save core file?


now I'm downloading out/Debug/node (129M)  & core.7355 (90M), then I will upload it to dropbox.


[root@etone46 node]# gdb --args out/Debug/node /usr/local/bin/npm list 
GNU gdb Red Hat Linux (6.5-25.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/libthread_db.so.1".

(gdb) run
Starting program: /opt/download/nodejs/node/out/Debug/node /usr/local/bin/npm list
[Thread debugging using libthread_db enabled]
[New process 7355]
[New Thread 1073809728 (LWP 7358)]
[New Thread 46912496273552 (LWP 7355)]
[New Thread 1074075968 (LWP 7359)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1074075968 (LWP 7359)]
0x00000000006fac8e in uv_async_send (handle=0x11c1dc8) at ../deps/uv/src/unix/async.c:56
56    r = write(handle->loop->async_pipefd[1], "x", 1);
Current language:  auto; currently c
(gdb) thread apply all backtrace full

Thread 4 (Thread 1074075968 (LWP 7359)):
#0  0x00000000006fac8e in uv_async_send (handle=0x11c1dc8) at ../deps/uv/src/unix/async.c:56
r = 0
#1  0x0000000000716984 in uv_eio_want_poll (channel=0x11c1d20) at ../deps/uv/src/unix/uv-eio.c:66
loop = (uv_loop_t *) 0x11c1d20
#2  0x00000000006fe9bf in etp_proc (thr_arg=0x1ded5760) at ../deps/uv/src/unix/eio/eio.c:2094
req = (eio_req *) 0x1df0f4e0
ts = {tv_sec = 0, tv_nsec = 843749568}
self = (etp_worker *) 0x1ded5760
#3  0x000000321180677d in start_thread () from /lib64/libpthread.so.0
No symbol table info available.
#4  0x0000003210cd33ed in clone () from /lib64/libc.so.6
No symbol table info available.

Thread 3 (Thread 46912496273552 (LWP 7355)):
#0  0x0000003210cd37d8 in epoll_wait () from /lib64/libc.so.6
No symbol table info available.
#1  0x0000000000702ef3 in epoll_poll (loop=0x11c23c0, timeout=2.399) at ../deps/uv/src/unix/ev/ev_epoll.c:150
i = 18621376
eventcnt = 0
#2  0x00000000007068ca in ev__run (loop=0x11c23c0, waittime=2.399) at ../deps/uv/src/unix/ev/ev.c:2542
No locals.
#3  0x00000000006fb824 in uv__poll (loop=0x11c1d20) at ../deps/uv/src/unix/core.c:247
No locals.
---Type <return> to continue, or q <return> to quit---
#4  0x00000000006fb86f in uv__run (loop=0x11c1d20) at ../deps/uv/src/unix/core.c:257
No locals.
#5  0x00000000006fb8c5 in uv_run (loop=0x11c1d20) at ../deps/uv/src/unix/core.c:265
No locals.
#6  0x000000000069838a in node::Start (argc=3, argv=0x1de99070) at ../src/node.cc:2968
locker = {has_lock_ = true, top_level_ = true, isolate_ = 0x1de8e070, static active_ = true}
context = {<v8::Handle<v8::Context>> = {val_ = 0x1dedbd60}, <No data fields>}
handle_scope = {isolate_ = 0x1de8e070, prev_next_ = 0x0, prev_limit_ = 0x0, is_closed_ = false}
context_scope = {context_ = {val_ = 0x1dedbd60}}
process_l = {val_ = 0x1dedbdc0}
argv_copy = (char **) 0x1de996b0
#7  0x00000000006aff13 in main (argc=3, argv=0x7fff3c67af08) at ../src/node_main.cc:65
No locals.

Thread 2 (Thread 1073809728 (LWP 7358)):
#0  0x0000003210c993b1 in nanosleep () from /lib64/libc.so.6
No symbol table info available.
#1  0x0000003210cccd34 in usleep () from /lib64/libc.so.6
No symbol table info available.
#2  0x0000000000c07a2a in v8::internal::SignalSender::Sleep (this=0x1ded2270, 
    full_or_half=v8::internal::SignalSender::FULL_INTERVAL) at ../deps/v8/src/platform-linux.cc:1194
interval = 900
result = 0
#3  0x0000000000c07bc3 in v8::internal::SignalSender::Run (this=0x1ded2270) at ../deps/v8/src/platform-linux.cc:1160
cpu_profiling_enabled = false
---Type <return> to continue, or q <return> to quit---
runtime_profiler_enabled = true
state = v8::internal::SamplerRegistry::HAS_SAMPLERS
#4  0x0000000000c06194 in ThreadEntry (arg=0x1ded2270) at ../deps/v8/src/platform-linux.cc:733
thread = (class v8::internal::Thread *) 0x1ded2270
#5  0x000000321180677d in start_thread () from /lib64/libpthread.so.0
No symbol table info available.
#6  0x0000003210cd33ed in clone () from /lib64/libc.so.6
No symbol table info available.

Thread 1 (LWP 7355):
#0  0x0000003210cd37d8 in epoll_wait () from /lib64/libc.so.6
No symbol table info available.
#1  0x0000000000702ef3 in epoll_poll (loop=0x11c23c0, timeout=2.399) at ../deps/uv/src/unix/ev/ev_epoll.c:150
i = 18621376
eventcnt = 0
#2  0x00000000007068ca in ev__run (loop=0x11c23c0, waittime=2.399) at ../deps/uv/src/unix/ev/ev.c:2542
No locals.
#3  0x00000000006fb824 in uv__poll (loop=0x11c1d20) at ../deps/uv/src/unix/core.c:247
No locals.
#4  0x00000000006fb86f in uv__run (loop=0x11c1d20) at ../deps/uv/src/unix/core.c:257

No locals.
#5  0x00000000006fb8c5 in uv_run (loop=0x11c1d20) at ../deps/uv/src/unix/core.c:265
No locals.
#6  0x000000000069838a in node::Start (argc=3, argv=0x1de99070) at ../src/node.cc:2968
locker = {has_lock_ = true, top_level_ = true, isolate_ = 0x1de8e070, static active_ = true}
---Type <return> to continue, or q <return> to quit---
context = {<v8::Handle<v8::Context>> = {val_ = 0x1dedbd60}, <No data fields>}
handle_scope = {isolate_ = 0x1de8e070, prev_next_ = 0x0, prev_limit_ = 0x0, is_closed_ = false}
context_scope = {context_ = {val_ = 0x1dedbd60}}
process_l = {val_ = 0x1dedbdc0}
argv_copy = (char **) 0x1de996b0
#7  0x00000000006aff13 in main (argc=3, argv=0x7fff3c67af08) at ../src/node_main.cc:65
No locals.
0x00000000006fac8e 56    r = write(handle->loop->async_pipefd[1], "x", 1);
(gdb) 
(gdb) 
(gdb) help gcore
Save a core file with the current state of the debugged process.
Argument is optional filename.  Default filename is 'core.<process_id>'.
(gdb) generate-core-file
Saved corefile core.7355

在 2012年8月17日星期五UTC+8下午5时35分54秒,Ben Noordhuis写道:

TZ (天猪)

unread,
Aug 17, 2012, 11:30:03 AM8/17/12
to nod...@googlegroups.com
https://www.dropbox.com/s/vgcgatk917fovmb/core.7355
https://www.dropbox.com/s/9oa3li8inq6wzx2/node


在 2012年8月17日星期五UTC+8下午5时35分54秒,Ben Noordhuis写道:

Ben Noordhuis

unread,
Aug 20, 2012, 10:48:46 AM8/20/12
to nod...@googlegroups.com
On Fri, Aug 17, 2012 at 5:30 PM, TZ (天猪) <ati...@qq.com> wrote:
> https://www.dropbox.com/s/vgcgatk917fovmb/core.7355
> https://www.dropbox.com/s/9oa3li8inq6wzx2/node

Thanks. I looked at it but couldn't find the culprit - there's a
uv_async_t handle that seems mostly uninitialized (most fields are 0
or NULL) for no apparent reason.

TZ (天猪)

unread,
Aug 20, 2012, 12:06:47 PM8/20/12
to nod...@googlegroups.com
sadly, should I give up? 

在 2012年8月20日星期一UTC+8下午10时48分46秒,Ben Noordhuis写道:

Ben Noordhuis

unread,
Aug 20, 2012, 12:10:39 PM8/20/12
to nod...@googlegroups.com
On Mon, Aug 20, 2012 at 6:06 PM, TZ (天猪) <ati...@qq.com> wrote:
> sadly, should I give up?

If you can somehow get a ssh tunnel going, I'll be happy look at it.
But right now there's not much I can do.

TZ (天猪)

unread,
Aug 21, 2012, 2:45:07 AM8/21/12
to nod...@googlegroups.com
hi, I found a pc(window, can be remote control from public) which can connect to the linux server.
could you plz send me an private email? (atian25  #  qq.com)

在 2012年8月21日星期二UTC+8上午12时10分39秒,Ben Noordhuis写道:

TZ (天猪)

unread,
Sep 13, 2012, 9:18:17 PM9/13/12
to nod...@googlegroups.com
hi, found this works: 
/usr/lib/nodejs/npm/bin/npm-cli.js list  

but npm list still segement fault



在 2012年8月20日星期一UTC+8下午10时48分46秒,Ben Noordhuis写道:
Reply all
Reply to author
Forward
0 new messages