Error: spawn EINVAL ?

Showing 1-10 of 10 messages
Error: spawn EINVAL ? TZ (天猪) 8/15/12 12:01 AM
do I miss something?
 
[root@etone46 backups]# node 1.js 
child_process.js:790
    throw errnoException(errno, 'spawn');
          ^
Error: spawn EINVAL
    at errnoException (child_process.js:838:11)
    at ChildProcess.spawn (child_process.js:790:11)
    at exports.spawn (child_process.js:614:9)
    at Object.<anonymous> (/opt/backups/1.js:3:14)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)


1.js is copy from docs:

var util  = require('util'),
    spawn = require('child_process').spawn,
        ls    = spawn('ls', ['-lh', '/usr']);
        ls.stdout.on('data', function (data) {
              console.log('stdout: ' + data);
        });
        ls.stderr.on('data', function (data) {
              console.log('stderr: ' + data);
        });
        ls.on('exit', function (code) {
              console.log('child process exited with code ' + code);
        });
Re: [nodejs] Error: spawn EINVAL ? Ben Noordhuis 8/15/12 3:11 AM
That error comes from inside libuv (e.g. the C runtime).

What platform is this? If it's Linux, what does `strace -e
\!mmap,munmap,mprotect,futex node 1.js` print?
Re: [nodejs] Error: spawn EINVAL ? TZ (天猪) 8/15/12 3:25 AM
It seems these is something wrong with this linux, 
any idea?

the same code run at ubuntu success but fail at this linux: 

[root@etone46 backups]# strace -e \!mmap,munmap,mprotect,futex node 1.js
execve("/usr/local/bin/node", ["node", "1.js"], [/* 30 vars */]) = 0
brk(0)                                  = 0x4e55000
uname({sys="Linux", node="etone46", ...}) = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=132373, ...}) = 0
close(3)                                = 0
open("/lib64/librt.so.1", O_RDONLY)     = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\"\300\f7\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=53480, ...}) = 0
close(3)                                = 0
open("/lib64/libdl.so.2", O_RDONLY)     = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \16\300\0077\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=23520, ...}) = 0
close(3)                                = 0
open("/usr/lib64/libstdc++.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\363\4\r7\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=976312, ...}) = 0
close(3)                                = 0
open("/lib64/libm.so.6", O_RDONLY)      = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200>\200\0077\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=615136, ...}) = 0
close(3)                                = 0
open("/lib64/libgcc_s.so.1", O_RDONLY)  = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\36\0\f7\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=58400, ...}) = 0
close(3)                                = 0
open("/lib64/libpthread.so.0", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 W\0\0107\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=141336, ...}) = 0
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY)      = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\331A\0077\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1687464, ...}) = 0
close(3)                                = 0
arch_prctl(ARCH_SET_FS, 0x2aaaaaad0830) = 0
set_tid_address(0x2aaaaaad08c0)         = 12792
set_robust_list(0x2aaaaaad08d0, 0x18)   = 0
rt_sigaction(SIGRTMIN, {0x3708005350, [], SA_RESTORER|SA_SIGINFO, 0x370800de60}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x37080052a0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x370800de60}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM_INFINITY}) = 0
brk(0)                                  = 0x4e55000
brk(0x4e76000)                          = 0x4e76000
getrlimit(RLIMIT_DATA, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0
clock_gettime(0x7 /* CLOCK_??? */, 0x7fff05f13600) = -1 EINVAL (Invalid argument)
clock_getres(0xfffffffa /* CLOCK_??? */, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {94647, 470339454}) = 0
fcntl(0, F_SETFD, FD_CLOEXEC)           = 0
fcntl(1, F_SETFD, FD_CLOEXEC)           = 0
fcntl(2, F_SETFD, FD_CLOEXEC)           = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = -1 EBADF (Bad file descriptor)
fcntl(4, F_SETFD, FD_CLOEXEC)           = -1 EBADF (Bad file descriptor)
fcntl(5, F_SETFD, FD_CLOEXEC)           = -1 EBADF (Bad file descriptor)
fcntl(6, F_SETFD, FD_CLOEXEC)           = -1 EBADF (Bad file descriptor)
fcntl(7, F_SETFD, FD_CLOEXEC)           = -1 EBADF (Bad file descriptor)
fcntl(8, F_SETFD, FD_CLOEXEC)           = -1 EBADF (Bad file descriptor)
fcntl(9, F_SETFD, FD_CLOEXEC)           = -1 EBADF (Bad file descriptor)
fcntl(10, F_SETFD, FD_CLOEXEC)          = -1 EBADF (Bad file descriptor)
fcntl(11, F_SETFD, FD_CLOEXEC)          = -1 EBADF (Bad file descriptor)
fcntl(12, F_SETFD, FD_CLOEXEC)          = -1 EBADF (Bad file descriptor)
fcntl(13, F_SETFD, FD_CLOEXEC)          = -1 EBADF (Bad file descriptor)
fcntl(14, F_SETFD, FD_CLOEXEC)          = -1 EBADF (Bad file descriptor)
fcntl(15, F_SETFD, FD_CLOEXEC)          = -1 EBADF (Bad file descriptor)
fcntl(16, F_SETFD, FD_CLOEXEC)          = -1 EBADF (Bad file descriptor)
rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
rt_sigaction(SIGINT, {0x5869f0, ~[RTMIN RT_1], SA_RESTORER, 0x370800de60}, NULL, 8) = 0
rt_sigaction(SIGTERM, {0x5869f0, ~[RTMIN RT_1], SA_RESTORER, 0x370800de60}, NULL, 8) = 0
clock_gettime(CLOCK_MONOTONIC, {94647, 471379454}) = 0
clock_gettime(CLOCK_MONOTONIC, {94647, 471436454}) = 0
getuid()                                = 0
geteuid()                               = 0
getgid()                                = 0
getegid()                               = 0
gettimeofday({1345025503, 426708}, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {94647, 471712454}) = 0
epoll_create(256)                       = 3
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
pipe([4, 5])                            = 0
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
fcntl(4, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
fcntl(5, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
rt_sigaction(SIGCHLD, {0x5da980, ~[RTMIN RT_1], SA_RESTORER|SA_RESTART, 0x370800de60}, NULL, 8) = 0
rt_sigaction(SIGUSR1, {0x586720, ~[RTMIN RT_1], SA_RESTORER, 0x370800de60}, NULL, 8) = 0
gettimeofday({1345025503, 427340}, NULL) = 0
brk(0x4e9d000)                          = 0x4e9d000
gettid()                                = 12792
brk(0x4ec2000)                          = 0x4ec2000
clone(child_stack=0x40010230, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x400109d0, tls=0x40010940, child_tidptr=0x400109d0) = 12793
gettimeofday({1345025503, 431639}, NULL) = 0
readlink("/proc/self/exe", "/usr/local/bin/node", 8191) = 19
brk(0x4f03000)                          = 0x4f03000
brk(0x4ed2000)                          = 0x4ed2000
brk(0x4f03000)                          = 0x4f03000
brk(0x4f43000)                          = 0x4f43000
brk(0x4ed2000)                          = 0x4ed2000
brk(0x4f03000)                          = 0x4f03000
getcwd("/opt/backups", 4096)            = 13
getcwd("/opt/backups", 4096)            = 13
clock_gettime(CLOCK_MONOTONIC, {94647, 499888454}) = 0
brk(0x4f43000)                          = 0x4f43000
brk(0x4fc4000)                          = 0x4fc4000
brk(0x4ed2000)                          = 0x4ed2000
syscall_293(0xe024f8, 0x80800, 0x4ea9c70, 0, 0x7fff05f12ce6, 0x12, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8) = 0x125
syscall_293(0xe024f8, 0x80800, 0xffffffffffffffff, 0x7fff05f12ce6, 0x12, 0x12, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8, 0x4e563d8) = 0x125
stat("/opt/backups/1.js", {st_mode=S_IFREG|0644, st_size=370, ...}) = 0
gettimeofday({1345025503, 465698}, NULL) = 0
gettimeofday({1345025503, 465826}, NULL) = 0
gettimeofday({1345025503, 465900}, NULL) = 0
lstat("/opt", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
gettimeofday({1345025503, 466561}, NULL) = 0
gettimeofday({1345025503, 466617}, NULL) = 0
gettimeofday({1345025503, 466673}, NULL) = 0
lstat("/opt/backups", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
gettimeofday({1345025503, 466887}, NULL) = 0
gettimeofday({1345025503, 466943}, NULL) = 0
gettimeofday({1345025503, 466998}, NULL) = 0
lstat("/opt/backups/1.js", {st_mode=S_IFREG|0644, st_size=370, ...}) = 0
gettimeofday({1345025503, 467179}, NULL) = 0
gettimeofday({1345025503, 467235}, NULL) = 0
gettimeofday({1345025503, 467290}, NULL) = 0
open("/opt/backups/1.js", O_RDONLY)     = 6
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
fstat(6, {st_mode=S_IFREG|0644, st_size=370, ...}) = 0
gettimeofday({1345025503, 468151}, NULL) = 0
gettimeofday({1345025503, 468208}, NULL) = 0
gettimeofday({1345025503, 468264}, NULL) = 0
read(6, "var util  = require(\'util\'),\n   "..., 370) = 370
close(6)                                = 0
brk(0x4f03000)                          = 0x4f03000
brk(0x4f44000)                          = 0x4f44000
brk(0x4f85000)                          = 0x4f85000
socketpair(PF_FILE, 0x80001 /* SOCK_??? */, 0, 0x4e9a290) = -1 EINVAL (Invalid argument)
socketpair(PF_FILE, SOCK_STREAM, 0, [6, 7]) = 0
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
fcntl(7, F_SETFD, FD_CLOEXEC)           = 0
socketpair(PF_FILE, 0x80001 /* SOCK_??? */, 0, 0x4e9a2
...
Re: [nodejs] Error: spawn EINVAL ? Ben Noordhuis 8/15/12 4:09 AM
On Wed, Aug 15, 2012 at 12:25 PM, TZ <ati...@qq.com> wrote:
> It seems these is something wrong with this linux,
> see also:
> https://groups.google.com/forum/?fromgroups#!topic/nodejs/ePqzZ7rPdzU
> any idea?
>
> the same code run at ubuntu success but fail at this linux:
>
>> [root@etone46 backups]# strace -e \!mmap,munmap,mprotect,futex node 1.js
>> syscall_293(0x7fff05f12c80, 0x80800, 0xffffffffffffffff, 0x7fff05f12bb0,
>> 0x1, 0x2, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3,
>> 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3) = 0x125

I think it may be this - a failing pipe2() syscall. Can you try this
patch? As a gist: https://gist.github.com/067bd9cb6f32c704e095

diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c
index 4d54e04..d6dfea2 100644
--- a/deps/uv/src/unix/process.c
+++ b/deps/uv/src/unix/process.c
@@ -99,7 +99,7 @@ int uv__make_pipe(int fds[2], int flags) {
   if (uv__pipe2(fds, flags | UV__O_CLOEXEC) == 0)
     return 0;

-  if (errno != ENOSYS)
+  if (errno != ENOSYS && errno != EINVAL)
     return -1;
 #endif
Re: [nodejs] Error: spawn EINVAL ? TZ (天猪) 8/15/12 8:01 AM
had patch, but still the same fail.

step:
1.cd /opt/download/nodejs/node
3.git patch
4.check if patched:  vi deps/uv/src/unix/process.c
 97 int uv__make_pipe(int fds[2], int flags) {
 98 #if __linux__
 99   if (uv__pipe2(fds, flags | UV__O_CLOEXEC) == 0)
100     return 0;
101 
102   if (errno != ENOSYS && errno != EINVAL)
103     return -1;
104 #endif

5.make && make install

在 2012年8月15日星期三UTC+8下午6时25分42秒,TZ写道:
socketpair(PF_FILE, 0x80001 /* SOCK_??? */, 0, 0x4e9a298) = -1 EINVAL (Invalid argument)
socketpair(PF_FILE, SOCK_STREAM, 0, [8, 9]) = 0
fcntl(8, F_SETFD, FD_CLOEXEC)           = 0
fcntl(9, F_SETFD, FD_CLOEXEC)           =
...
Re: [nodejs] Error: spawn EINVAL ? Ben Noordhuis 8/15/12 1:27 PM
On Wed, Aug 15, 2012 at 5:01 PM, TZ <ati...@qq.com> wrote:
> had patch, but still the same fail.
>
> step:
> 1.cd /opt/download/nodejs/node
> 2.wget
> https://raw.github.com/gist/067bd9cb6f32c704e095/f08353c36ca01cfe7b7df5f4f832b401c9c564f1/patsje.patch
> 3.git patch
> 4.check if patched:  vi deps/uv/src/unix/process.c
>  97 int uv__make_pipe(int fds[2], int flags) {
>  98 #if __linux__
>  99   if (uv__pipe2(fds, flags | UV__O_CLOEXEC) == 0)
> 100     return 0;
> 101
> 102   if (errno != ENOSYS && errno != EINVAL)
> 103     return -1;
> 104 #endif
>
> 5.make && make install

If you give me a shell account with gcc and gdb installed I can
probably debug it. My pubkey is here:
https://gist.github.com/e8a37ac6983f9fd55d4f
Re: [nodejs] Error: spawn EINVAL ? TZ (天猪) 8/15/12 4:20 PM
sorr, it's a server in intranet. I can fully control it , but I don't have permission to change the mapping of intranet router.
is there any other way to connect? such as a reverse proxy by node ?( but I don't have a static ip server)

在 2012年8月16日星期四UTC+8上午4时27分19秒,Ben Noordhuis写道:
Re: [nodejs] Error: spawn EINVAL ? TZ (天猪) 8/15/12 7:08 PM
had installed node v0.8.7 from git, the same error.

is the glibc version too low ?
when download node-v0.8.7-darwin-x64.tar.gz and exec it warn :

[root@etone46 bin]# ./node
./node: /lib64/libc.so.6: version `GLIBC_2.9' not found (required by ./node)
./node: /lib64/libc.so.6: version `GLIBC_2.6' not found (required by ./node)
./node: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by ./node)
[root@etone46 bin]# pwd
/opt/download/nodejs/node-v0.8.7-linux-x64/bin

[root@etone46 glibc-2.9]# ldd --version          
ldd (GNU libc) 2.5
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.
Written by Roland McGrath and Ulrich Drepper.
[root@etone46 glibc-2.9]# rpm -qa | grep glibc
glibc-headers-2.5-81.el5_8.4
glibc-common-2.5-81.el5_8.4
compat-glibc-2.3.4-2.26
glibc-devel-2.5-81.el5_8.4
compat-glibc-2.3.4-2.26
glibc-2.5-81.el5_8.4
glibc-devel-2.5-81.el5_8.4
glibc-2.5-81.el5_8.4
compat-glibc-headers-2.3.4-2.26

在 2012年8月16日星期四UTC+8上午7时20分43秒,TZ写道:
Re: [nodejs] Error: spawn EINVAL ? Ben Noordhuis 8/16/12 4:53 AM
On Thu, Aug 16, 2012 at 1:20 AM, TZ <ati...@qq.com> wrote:
> sorr, it's a server in intranet. I can fully control it , but I don't have
> permission to change the mapping of intranet router.
> is there any other way to connect? such as a reverse proxy by node ?( but I
> don't have a static ip server)

I guess we could set up a reverse ssh tunnel or something (provided
you can ssh out) but that's something of a hassle to set up.

> is the glibc version too low ?

Well... 2.5 is quite ancient but it *should* work - when it comes to
making syscalls, libuv mostly bypasses glibc.
Re: [nodejs] Error: spawn EINVAL ? TZ (天猪) 8/16/12 7:39 AM
since don't find rpm for redhat5, I had install glibc2.9 by git , but install to /usr/local/glibc2.9. I dared not to ln it to default.(is it safe?)

so it's there any way to figure out this problem?


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