Strider-CD / strider

Open Source Continuous Integration & Deployment Server
http://strider-cd.github.io/
4.59k stars 432 forks source link

Unexpected server error: -302 undefined undefined undefined Error #162

Closed pedrofranceschi closed 10 years ago

pedrofranceschi commented 10 years ago

Hi,

I'm trying to use Strider with my project, but after running npm install, the server logs this error:

4 Aug 12:48:20 - info: Got new job
4 Aug 12:48:20 - info: Processing job 51fe77c4b1540f6fe900000a
4 Aug 12:48:20 - info: running command rm -rf /Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject; mkdir -p /Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject undefined
4 Aug 12:48:20 - info: done with sh [ '-c',
  'rm -rf /Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject; mkdir -p /Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject' ] 0
4 Aug 12:48:28 - info: collecting phases
4 Aug 12:48:28 - info: skipping deploy phase; test run
4 Aug 12:48:28 - info: Running phase prepare
4 Aug 12:48:28 - info: running command sh [ '-c', 'npm install' ]
4 Aug 12:53:31 - info: api.jobs
4 Aug 12:59:27 - info: Done with phase prepare { phase: 'prepare', code: -302, tasks: undefined }
4 Aug 12:59:27 - info: finished with all phases
4 Aug 12:59:27 - info: Running phase cleanup
4 Aug 12:59:27 - info: running command sh [ '-c', 'echo "cleanup...";' ]
4 Aug 12:59:27 - info: Done with phase cleanup null
4 Aug 12:59:27 - error: Unexpected server error: -302 undefined undefined undefined Error
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/job.js:80:101)
    at EventEmitter.emit (events.js:95:17)
    at Function.<anonymous> (/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/worker.js:100:16)
    at next (/usr/local/lib/node_modules/strider/node_modules/step/lib/step.js:51:23)
    at /usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/utils.js:207:11
    at /usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/utils.js:194:11
    at /usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:190:13
    at /usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:116:25
    at /usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:187:17
    at /usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:491:34
4 Aug 12:59:27 - info: done 500
4 Aug 12:59:27 - info: done 0

The web console tells me this:

[STRIDER] $ echo "cleanup...";
strider $ echo "cleanup...";
cleanup...
[STRIDER] Custom cleanup command `echo "cleanup...";` failed with exit code -302
[STRIDER] ERROR Worker error occurred. Please report this to https://github.com/Strider-CD/strider/. Thank you.

If I remove my cleanup command, it keeps failing too.

What can I do to fix this bug? I'd really like to try Strider.

Thanks,

Pedro

jaredly commented 10 years ago

Ah interesting. I think I know where that's coming from. For now, how about you go with the last release (1.3.2) I think that should work for you. Or you could try the docker install; that's a great way to try out strider.

Pedro Franceschi notifications@github.com wrote:

Hi,

I'm trying to use Strider with my project, but after running npm install, the server logs this error:

4 Aug 12:48:20 - info: Processing job 51fe77c4b1540f6fe900000a
4 Aug 12:48:20 - info: running command rm -rf
/Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject;
mkdir -p
/Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject
undefined
4 Aug 12:48:20 - info: done with sh [ '-c',
'rm -rf
/Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject;
mkdir -p
/Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject' ]
0
4 Aug 12:48:28 - info: collecting phases
4 Aug 12:48:28 - info: skipping deploy phase; test run
4 Aug 12:48:28 - info: Running phase prepare
4 Aug 12:48:28 - info: running command sh [ '-c', 'npm install' ]
4 Aug 12:53:31 - info: api.jobs
4 Aug 12:59:27 - info: Done with phase prepare { phase: 'prepare',
code: -302, tasks: undefined }
4 Aug 12:59:27 - info: finished with all phases
4 Aug 12:59:27 - info: Running phase cleanup
4 Aug 12:59:27 - info: running command sh [ '-c', 'echo "cleanup...";'
]
4 Aug 12:59:27 - info: Done with phase cleanup null
4 Aug 12:59:27 - error: Unexpected server error: -302 undefined
undefined undefined Error
at EventEmitter.<anonymous>
(/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/job.js:80:101)
   at EventEmitter.emit (events.js:95:17)
at Function.<anonymous>
(/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/worker.js:100:16)
at next
(/usr/local/lib/node_modules/strider/node_modules/step/lib/step.js:51:23)
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/utils.js:207:11
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/utils.js:194:11
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:190:13
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:116:25
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:187:17
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:491:34
4 Aug 12:59:27 - info: done 500
4 Aug 12:59:27 - info: done 0

The web console tells me this:

strider $ echo "cleanup...";
cleanup...
[STRIDER] Custom cleanup command `echo "cleanup...";` failed with exit
code -302
[STRIDER] ERROR Worker error occurred. Please report this to
https://github.com/Strider-CD/strider/. Thank you.```

If I remove my cleanup command, it keeps failing too.

What can I do to fix this bug? I'd really like to try Strider.

Thanks,

Pedro

---
Reply to this email directly or view it on GitHub:
https://github.com/Strider-CD/strider/issues/162

Sent from my Android device with K-9 Mail. Please excuse my brevity.

pedrofranceschi commented 10 years ago

Actually, I'm using 1.3.2 and I'm getting this bug.

Docker is an option, but I'ld like to use Strider locally because I want to be able to contribute with the project too.

On Aug 4, 2013, at 3:19 PM, Jared Forsyth notifications@github.com wrote:

Ah interesting. I think I know where that's coming from. For now, how about you go with the last release (1.3.2) I think that should work for you. Or you could try the docker install; that's a great way to try out strider.

Pedro Franceschi notifications@github.com wrote:

Hi,

I'm trying to use Strider with my project, but after running npm install, the server logs this error:

4 Aug 12:48:20 - info: Processing job 51fe77c4b1540f6fe900000a
4 Aug 12:48:20 - info: running command rm -rf
/Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject;
mkdir -p
/Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject
undefined
4 Aug 12:48:20 - info: done with sh [ '-c',
'rm -rf
/Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject;
mkdir -p
/Users/pedrofranceschi/.strider/51fdf19a4ecd4166db000008.testproject' ]
0
4 Aug 12:48:28 - info: collecting phases
4 Aug 12:48:28 - info: skipping deploy phase; test run
4 Aug 12:48:28 - info: Running phase prepare
4 Aug 12:48:28 - info: running command sh [ '-c', 'npm install' ]
4 Aug 12:53:31 - info: api.jobs
4 Aug 12:59:27 - info: Done with phase prepare { phase: 'prepare',
code: -302, tasks: undefined }
4 Aug 12:59:27 - info: finished with all phases
4 Aug 12:59:27 - info: Running phase cleanup
4 Aug 12:59:27 - info: running command sh [ '-c', 'echo "cleanup...";'
]
4 Aug 12:59:27 - info: Done with phase cleanup null
4 Aug 12:59:27 - error: Unexpected server error: -302 undefined
undefined undefined Error
at EventEmitter.<anonymous>
(/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/job.js:80:101)
at EventEmitter.emit (events.js:95:17)
at Function.<anonymous>
(/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/worker.js:100:16)
at next
(/usr/local/lib/node_modules/strider/node_modules/step/lib/step.js:51:23)
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/utils.js:207:11
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/lib/utils.js:194:11
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:190:13
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:116:25
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:187:17
at
/usr/local/lib/node_modules/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:491:34
4 Aug 12:59:27 - info: done 500
4 Aug 12:59:27 - info: done 0

The web console tells me this:

strider $ echo "cleanup...";
cleanup...
[STRIDER] Custom cleanup command `echo "cleanup...";` failed with exit
code -302
[STRIDER] ERROR Worker error occurred. Please report this to
https://github.com/Strider-CD/strider/. Thank you.```

If I remove my cleanup command, it keeps failing too.

What can I do to fix this bug? I'd really like to try Strider.

Thanks,

Pedro

---
Reply to this email directly or view it on GitHub:
https://github.com/Strider-CD/strider/issues/162

Sent from my Android device with K-9 Mail. Please excuse my brevity. — Reply to this email directly or view it on GitHub.

jaredly commented 10 years ago

That's fantastic! So I just tried to reproduce this on v 1.3.2, and wasn't able to. What os & version of node are you using? That -302 exit code indicates that the pseudoterminal isn't correctly reporting the exit code of the command run ... can't imagine what would cause that though. I'm on OSX 10.7.5, tested with node 0.8.25. looking at 0.10 now

pedrofranceschi commented 10 years ago

I'm using Node 0.10.12 and OS X 10.8.3.

Thanks.

On Aug 4, 2013, at 4:05 PM, Jared Forsyth notifications@github.com wrote:

That's fantastic! So I just tried to reproduce this on v 1.3.2, and wasn't able to. What os & version of node are you using? That -302 exit code indicates that the pseudoterminal isn't correctly reporting the exit code of the command run ... can't imagine what would cause that though. I'm on OSX 10.7.5, tested with node 0.8.25. looking at 0.10 now

— Reply to this email directly or view it on GitHub.

jaredly commented 10 years ago

Ah. Just got the error using 0.10.15. So strange. I'll see what I can do.

pedrofranceschi commented 10 years ago

That's awesome, thanks!

On Aug 4, 2013, at 4:10 PM, Jared Forsyth notifications@github.com wrote:

Ah. Just got the error using 0.10.15. So strange. I'll see what I can do.

— Reply to this email directly or view it on GitHub.

jaredly commented 10 years ago

Now it does look like the builds are passing, though [even with the ugly error]. Is that what's happening with you?

jaredly commented 10 years ago

Ok, the npm registry is really unreliable atm, and I have to go. I should be able to get this nailed down tomorrow.

niallo commented 10 years ago

I see the bug. Fixing now.

niallo commented 10 years ago

@pedrofranceschi please delete your node_modules and re-install. I just fixed a bug in pty.js:

https://github.com/niallo/pty.js/commit/1586aae0c19246e931d2d79d2b99208828532449

pedrofranceschi commented 10 years ago

That's weird... After reinstalling, I still get this error in console:

4 Aug 20:14:21 - error: Unexpected server error: -302 undefined undefined undefined Error
    at EventEmitter.<anonymous> (/Users/pedrofranceschi/Desktop/TUDO/strider/node_modules/strider-simple-worker/lib/job.js:80:101)
    at EventEmitter.emit (events.js:95:17)
    at Function.<anonymous> (/Users/pedrofranceschi/Desktop/TUDO/strider/node_modules/strider-simple-worker/lib/worker.js:100:16)
    at next (/Users/pedrofranceschi/Desktop/TUDO/strider/node_modules/step/lib/step.js:51:23)
    at /Users/pedrofranceschi/Desktop/TUDO/strider/node_modules/strider-simple-worker/lib/utils.js:207:11
    at /Users/pedrofranceschi/Desktop/TUDO/strider/node_modules/strider-simple-worker/lib/utils.js:194:11
    at /Users/pedrofranceschi/Desktop/TUDO/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:190:13
    at /Users/pedrofranceschi/Desktop/TUDO/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:116:25
    at /Users/pedrofranceschi/Desktop/TUDO/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:187:17
    at /Users/pedrofranceschi/Desktop/TUDO/strider/node_modules/strider-simple-worker/node_modules/async/lib/async.js:491:34
niallo commented 10 years ago

Can you confirm you have the version of pty.js with my commit in it? If you rm -rf strider-simple-worker under node_modules and re-run npm install I think it should pull it in.

EDIT: wait, actually I am still seeing this myself locally on a different mac. investigating more.

niallo commented 10 years ago

Ok I think something (probably node) is replacing our SIGCHLD handler under certain conditions sigh.

jaredly commented 10 years ago

yeah that's what I just found too. :( should we go back to the "echo $?" hack until things get sorted out?

On Sun, Aug 4, 2013 at 6:03 PM, niallo notifications@github.com wrote:

Ok I think something (probably node) is replacing our SIGCHLD handler under certain conditions sigh.

— Reply to this email directly or view it on GitHubhttps://github.com/Strider-CD/strider/issues/162#issuecomment-22081803 .

pedrofranceschi commented 10 years ago

I just confirmed and I'm in the latest version of pty.js.

On Aug 4, 2013, at 9:06 PM, Jared Forsyth notifications@github.com wrote:

yeah that's what I just found too. :( should we go back to the "echo $?" hack until things get sorted out?

On Sun, Aug 4, 2013 at 6:03 PM, niallo notifications@github.com wrote:

Ok I think something (probably node) is replacing our SIGCHLD handler under certain conditions sigh.

— Reply to this email directly or view it on GitHubhttps://github.com/Strider-CD/strider/issues/162#issuecomment-22081803 .

— Reply to this email directly or view it on GitHub.

jaredly commented 10 years ago

Ah, it looks like if you run a child_process (in node 0.10!) it reinstalls the sigchld handler. Clever them.

On Sun, Aug 4, 2013 at 6:06 PM, Jared Forsyth jabapyth@gmail.com wrote:

yeah that's what I just found too. :( should we go back to the "echo $?" hack until things get sorted out?

On Sun, Aug 4, 2013 at 6:03 PM, niallo notifications@github.com wrote:

Ok I think something (probably node) is replacing our SIGCHLD handler under certain conditions sigh.

— Reply to this email directly or view it on GitHubhttps://github.com/Strider-CD/strider/issues/162#issuecomment-22081803 .

niallo commented 10 years ago

Yeah. There isn't anything we can do other than hack libuv to tell it about our child process I think. The pty.js approach is just broken.

I'm not happy with the exit $? hack because it doesn't always work.

jaredly commented 10 years ago

No, I think we can just reinstall ours whenever a new pty term is created. Right? (trying now)

On Sun, Aug 4, 2013 at 6:13 PM, niallo notifications@github.com wrote:

Yeah. There isn't anything we can do other than hack libuv to tell it about our child process I think. The pty.js approach is just broken.

I'm not happy with the exit $? hack because it doesn't always work.

— Reply to this email directly or view it on GitHubhttps://github.com/Strider-CD/strider/issues/162#issuecomment-22081933 .

niallo commented 10 years ago

No, because what's to stop a child_process call in between us creating ours and it finishing? There is a race condition.

niallo commented 10 years ago

I mean something like this in PtyFork() will "work" but there is still a race condition:

      // retrieve current SIGCHLD handler.
      struct sigaction cur_action;
      cur_action.sa_flags = SA_SIGINFO;
      sigaction(SIGCHLD, NULL, &cur_action);
      if (cur_action.sa_sigaction != sigChldHandler) {
        printf("think our SIGCHLD handler has been replaced\n");
        node_sighandler = cur_action.sa_handler;
        struct sigaction action;
        memset (&action, '\0', sizeof(action));
        action.sa_sigaction = sigChldHandler;
        action.sa_flags = SA_SIGINFO;
        action.sa_flags |= SA_NOCLDSTOP;
        // set new SIGCHLD handler. this will call node/libuv's handler at the end.
        sigaction(SIGCHLD, &action, NULL);
      }
jaredly commented 10 years ago

you're right, there is.

jaredly commented 10 years ago

so we hack node ... and in the mean time? we use the "echo $?" hack, and if the process is killed we don't complain.

niallo commented 10 years ago

echo $? hack is broken though because it doesn't work with any process that calls one of the exec(3) family of functions.

An equally broken alternative is to use two maps and default exit code to 0 (like we were effectively doing before pidMap[pid] = -302) in the case that our SIGCHLD handler was replaced. We could use the above in PtyFork to "best effort" it.

jaredly commented 10 years ago

True. or we could do without pty, which would be sad. Granted, if we have singleton workers executing one job at a time, we will pretty well avoid the race condition ;)

On Sun, Aug 4, 2013 at 6:25 PM, niallo notifications@github.com wrote:

echo $? hack is broken though because it doesn't work with any process that calls one of the exec(3) family of functions.

An equally broken alternative is to use two maps and default exit code to 0 (like we were effectively doing before pidMap[pid] = -302) in the case that our SIGCHLD handler was replaced. We could use the above in PtyForkto "best effort" it.

— Reply to this email directly or view it on GitHubhttps://github.com/Strider-CD/strider/issues/162#issuecomment-22082160 .

niallo commented 10 years ago

Yes, and so long as plugins aren't spawning child processes - which they might :)

I dunno. It just seems very bad to have unreliable and non-deterministic reporting of exit codes. It feels like it could lead to really crazy hair pulling debug session - as it kinda already has :)

niallo commented 10 years ago

Perhaps we should pick either exit $? hack or pty.js race condition hack, and default PTY support to off. If you really want teh pretty you can turn it on and YMMV. But we should strive to give the most stable experience out of the box.

Meanwhile, we can work on trying to fix this in node/libuv.

jaredly commented 10 years ago

totally. too bad node is buggy.

On Sun, Aug 4, 2013 at 6:29 PM, niallo notifications@github.com wrote:

Yes, and so long as plugins aren't spawning child processes - which they might :)

I dunno. It just seems very bad to have unreliable and non-deterministic reporting of exit codes. It feels like it could lead to really crazy hair pulling debug session - as it kinda already has :)

— Reply to this email directly or view it on GitHubhttps://github.com/Strider-CD/strider/issues/162#issuecomment-22082225 .

jaredly commented 10 years ago

sure, that makes sense.

On Sun, Aug 4, 2013 at 6:31 PM, niallo notifications@github.com wrote:

Perhaps we should pick either exit $? hack or pty.js race condition hack, and default PTY support to off. If you really want teh pretty you can turn it on and YMMV. But we should strive to give the most stable experience out of the box.

Meanwhile, we can work on trying to fix this in node/libuv.

— Reply to this email directly or view it on GitHubhttps://github.com/Strider-CD/strider/issues/162#issuecomment-22082243 .

niallo commented 10 years ago

Do you want to make it disabled by default, and we can document it as an 'experimental' feature people can try (with caveats) until we fix node/libuv?

Then I can publish 1.3.3

peterbraden commented 10 years ago

That sucks - we should definitely file an issue in node.

jaredly commented 10 years ago

@niallo Ok that's done. I made changes to strider and strider-simple-worker.

niallo commented 10 years ago

Thanks @jaredly - you rock. I'll test this out and then publish in a bit.

niallo commented 10 years ago

@pedrofranceschi We just released Strider 1.3.3 to NPM which shouldn't have this issue. Please try. Thanks for the report!

pedrofranceschi commented 10 years ago

It worked perfectly, thanks!

Strider is really nice, please keep up the good work. I'll try to collaborate to the project as soon as I have some free time.

On Aug 4, 2013, at 11:38 PM, niallo notifications@github.com wrote:

@pedrofranceschi We just released Strider 1.3.3 to NPM which shouldn't have this issue. Please try. Thanks for the report!

— Reply to this email directly or view it on GitHub.