isaacs/npm — Issue #2156: npm install hangs after with 2 node-waf processes using same  /tmp/npm-1329179091810/1329179099457-0.30766689125448465/tmp.tgz
Author: emiloslavsky
Created: 2012-02-14 01:08:04+00:00
State: open

my program depends on aws2js
npm install hangs occasionally (1 out 10 times).
It looks like 2 node-waf processes are hung in futex:

root@ip-10-160-138-223:~# ps -ef |grep py
root 1066 1065 0 00:25 ? 00:00:00 python /usr/local/bin/node-waf configure build
root 1192 1066 0 00:25 ? 00:00:00 python /usr/local/bin/node-waf configure build

# strace -p 1192 -p 1066 |tee /tmp/strace1
Process 1192 attached - interrupt to quit
Process 1066 attached - interrupt to quit
[pid 1192] futex(0x1c83090, FUTEX_WAIT_PRIVATE, 0, NULL
[pid 1066] futex(0x208e7b0, FUTEX_WAIT_PRIVATE, 0, NULL^C

It looks like these 2 processes are waiting on the same file:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
~# lsof | egrep "1066|1192"
sshd 570 root mem REG 202,1 101192 395358 /lib/x86_64-linux-gnu/libresolv-2.13.so
ntpd 956 ntp mem REG 202,1 101192 395358 /lib/x86_64-linux-gnu/libresolv-2.13.so
node 1059 root mem REG 202,1 101192 395358 /lib/x86_64-linux-gnu/libresolv-2.13.so
python 1066 root cwd DIR 202,1 4096 276627 /srv/nucleus/repo/cloudmanager/node_modules/aws2js/node_modules/libxmljs/build
python 1066 root rtd DIR 202,1 4096 2 /
python 1066 root txt REG 202,1 2735256 960 /usr/bin/python2.7
python 1066 root mem REG 202,1 141088 395318 /lib/x86_64-linux-gnu/ld-2.13.so
python 1066 root mem REG 202,1 135500 395357 /lib/x86_64-linux-gnu/libpthread-2.13.so
python 1066 root mem REG 202,1 14768 395331 /lib/x86_64-linux-gnu/libdl-2.13.so
python 1066 root mem REG 202,1 10640 395366 /lib/x86_64-linux-gnu/libutil-2.13.so
python 1066 root mem REG 202,1 332384 395362 /lib/x86_64-linux-gnu/libssl.so.1.0.0
python 1066 root mem REG 202,1 1749000 395329 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
python 1066 root mem REG 202,1 96816 395369 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
python 1066 root mem REG 202,1 538928 395341 /lib/x86_64-linux-gnu/libm-2.13.so
python 1066 root mem REG 202,1 1677624 395325 /lib/x86_64-linux-gnu/libc-2.13.so
python 1066 root mem REG 202,1 35712 395345 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
python 1066 root mem REG 202,1 97256 395344 /lib/x86_64-linux-gnu/libnsl-2.13.so
python 1066 root mem REG 202,1 47696 395349 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
python 1066 root mem REG 202,1 51736 395347 /lib/x86_64-linux-gnu/libnss_files-2.13.so
python 1066 root mem REG 202,1 21680 9230 /usr/lib/python2.7/lib-dynload/_heapq.so
python 1066 root mem REG 202,1 92768 9242 /usr/lib/python2.7/lib-dynload/datetime.so
python 1066 root mem REG 202,1 24576 9255 /usr/lib/python2.7/lib-dynload/termios.so
python 1066 root 0u CHR 1,3 0t0 5110 /dev/null
python 1066 root 1u CHR 1,3 0t0 5110 /dev/null
python 1066 root 2u CHR 1,3 0t0 5110 /dev/null
python 1066 root 3r FIFO 0,8 0t0 7580 pipe
python 1066 root 5w REG 202,1 608726 275658 /srv/nucleus/repo/cloudmanager/node_modules/aws2js/node_modules/mime-magic/arc/file-5.10.tar.gz
python 1066 root 6w REG 202,1 1945600 18351 /tmp/npm-1329179091810/1329179099457-0.30766689125448465/tmp.tgz
python 1192 root cwd DIR 202,1 4096 276627 /srv/nucleus/repo/cloudmanager/node_modules/aws2js/node_modules/libxmljs/build
python 1192 root rtd DIR 202,1 4096 2 /
python 1192 root txt REG 202,1 2735256 960 /usr/bin/python2.7
python 1192 root mem REG 202,1 141088 395318 /lib/x86_64-linux-gnu/ld-2.13.so
python 1192 root mem REG 202,1 135500 395357 /lib/x86_64-linux-gnu/libpthread-2.13.so
python 1192 root mem REG 202,1 14768 395331 /lib/x86_64-linux-gnu/libdl-2.13.so
python 1192 root mem REG 202,1 10640 395366 /lib/x86_64-linux-gnu/libutil-2.13.so
python 1192 root mem REG 202,1 332384 395362 /lib/x86_64-linux-gnu/libssl.so.1.0.0
python 1192 root mem REG 202,1 1749000 395329 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
python 1192 root mem REG 202,1 96816 395369 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
python 1192 root mem REG 202,1 538928 395341 /lib/x86_64-linux-gnu/libm-2.13.so
python 1192 root mem REG 202,1 1677624 395325 /lib/x86_64-linux-gnu/libc-2.13.so
python 1192 root mem REG 202,1 35712 395345 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
python 1192 root mem REG 202,1 97256 395344 /lib/x86_64-linux-gnu/libnsl-2.13.so
python 1192 root mem REG 202,1 47696 395349 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
python 1192 root mem REG 202,1 51736 395347 /lib/x86_64-linux-gnu/libnss_files-2.13.so
python 1192 root mem REG 202,1 21680 9230 /usr/lib/python2.7/lib-dynload/_heapq.so
python 1192 root mem REG 202,1 92768 9242 /usr/lib/python2.7/lib-dynload/datetime.so
python 1192 root mem REG 202,1 24576 9255 /usr/lib/python2.7/lib-dynload/termios.so
python 1192 root 0u CHR 1,3 0t0 5110 /dev/null
python 1192 root 1u CHR 1,3 0t0 5110 /dev/null
python 1192 root 2u CHR 1,3 0t0 5110 /dev/null
python 1192 root 3r FIFO 0,8 0t0 7580 pipe
python 1192 root 4w FIFO 0,8 0t0 7580 pipe
python 1192 root 5w REG 202,1 608726 275658 /srv/nucleus/repo/cloudmanager/node_modules/aws2js/node_modules/mime-magic/arc/file-5.10.tar.gz
python 1192 root 6w REG 202,1 1945600 18351 /tmp/npm-1329179091810/1329179099457-0.30766689125448465/tmp.tgz
sshd 4366 root mem REG 202,1 101192 395358 /lib/x86_64-linux-gnu/libresolv-2.13.so
sshd 4393 ubuntu mem REG 202,1 101192 395358 /lib/x86_64-linux-gnu/libresolv-2.13.so

~# uname -a
Linux jjj-virtual #23-Ubuntu SMP Mon Nov 21 21:09:11 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
~# node --version
v0.6.7
~# npm --version
1.1.0-beta-10