-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Too Many Unstable Restarts #659
Comments
Are you using
|
hi @soyuka - we do a fresh install and npm install for each deployment - but just to be sure - I've followed your suggestion above - and am still getting the exact same error :-( |
Weird, I just tried with Could you try |
okay - thanks for the reply @soyuka - i've run out of time for today - but will try again over the next few ;-) |
I've also just tried it with your gist - and it works. So there's something up with our app. I can close this if you like, and then open again when I've worked out what it is. Any suggestions as to what I might be able to do to trace the error? |
Those might be really hard to trace but I'd suggest a clean environment where you install a clean node. Does the app starts with |
Yup - it's running fine with
|
If you can give me a way to reproduce the issue I'd be glad to help but right know I have not enough informations :/. |
i'll try a few more things over the weekend. the architecture I'm using is based mainly on this app - https://github.com/hueniverse/postmile - and it also works fine, so I'll start to tear things down over the weekend and see if I can isolate what we're doing that's different. |
Found it - for production and staging environments - I turned off console logging in the application - and everything is fine. stdout would have been coming from two sources (each of the two node servers). I'm not sure what that meant internally for pm2 - but turning off the console logger solved it :-) (and I still have regular file logging working fine). |
I also have this issue, also with hapi (likely the good plugin). I speculate that the way pm2 is watching stdout and stderr is exposing some sort of libuv bug. Thoughts? |
I had this problem as well. My work around involved removing a call to |
I ran into the same issue deploying a Hapi based app. Disabling the Good plugin solved the error for me. |
Which plugin was it?
|
https://github.com/hapijs/good - same for me - although I solved the problem by disabling console output (while keeping the file logger). |
Not sure if tagging the Good maintainer here works - but just in case... @lloydbenson |
I'm having the same issue - also using the hapijs good plugin. Its a really good logging utility so would be great if we can figure out how to fix this (besides disabling the console output!) 👍 |
Yes having the same issue - default expressjs. Reproducing the issue: express test1
cd test1
npm install
pm2 start app.js This one comes from the log - pm2 logs app
PM2 version
Node version
|
Just a thought here, but is it possible that it had something to do with the colorized console output? I know that Express colorizes for different requests and good added colorized console logging here. |
I have several apps that use colorized output that do not cause this error, only the one using the Good.GoodConsole did. |
@58bits, I just tried disabling the Good.GoodConsole reporter (leaving just the file reporter) but this still happens for me. What version of PM2 are you running, and what version of Good? If we can narrow it down potentially we'll find the difference and then in turn find the issue. This is a real hold up for me as we want to use the Good Reporting utility, but also want to use PM2! |
To add to this discussion, I'm running into this issue with [email protected], but it appears to works fine with [email protected]. |
@jingchan, this is good to know. Unfortunately, they completely re-architected the internals between those versions (as you'd expect with major version number changes), so its hard to compare in GitHub |
OK guys, I have "fixed" the problem, but I'm not passing all the tests. This error goes away if we change the FD0 pipe in ForkMode from "ipc" to "ignore". See commit d44ff7d on chriswiggins/pm2#development Why is this? Any ideas? |
In addition to above, after testing, I have never used IPC before but disabling it causes all sorts of errors as a process running under PM2 is unable to do a process.send(). Maybe file descriptors are being assigned in random ways. This is way over my head :-) |
I think it should be |
Hi @chriswiggins - thanks a bunch for this - and sorry I didn't get back to you sooner. An avalanche of work at the moment. :-( |
Have opened an issue with a test case over at hapijs/good#236. Hopefully we can get to the bottom of this |
Ok team. Two outcomes: Hapijs/good have tidied up a part of the plugin implementation, in the process causing this error to go away. PM2 shouldn't really attach IPC to FD0 in forkmode, but I've tried making it the fourth descriptor (as IPC is obviously needed) but some of the tests just hang. The other alternative is to not use spawn, but the actual fork method which does the correct IPC stuff by default. I'll keep inspecting. Is there a PM2 IRC channel or similar? Would love to discuss some of this stuff in real time! Maybe even using Gitter would be good? |
This looks interesting, any thoughts @jshkurti ? By sending Basically fork uses spawn with these settings:
https://github.com/joyent/node/blob/master/lib/child_process.js#L572 Using the Gitter: https://gitter.im/Unitech/PM2 |
I can confirm that in the latest version of the good plugin, (and latest pm2) this problem has been resolved. As much as I'd like to participate in the discussion, this is way above me. :-). Should I go ahead and close this issue? |
Yes please @58bits. Glad we could solve it as now I've got what I want working too. Power of the community! |
Actually, leave it open. We'll close when we pull in the FD4 fix. |
w00t! |
You are right, I had the same issue in my code and solved it by commenting the a line to create a pipe with child's stdin: var cp = spawn(SPAWN_BIN, SPAWN_ARGS, {"env": env});
cp.stdout.pipe(process.stdout);
cp.stderr.pipe(process.stderr);
// https://github.com/Unitech/PM2/issues/659
// process.stdin.pipe is causing the following error when using PM2
//node: ../deps/uv/src/unix/core.c:701: uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed.
//process.stdin.pipe(cp.stdin); Thank you!!! |
It should be working now that IPC has been moved to the 4th file descriptor. Could you give it a shot? |
This is now working for me using: [email protected], [email protected], [email protected] |
Sorry, it's a big project and I can't change software/library versions yet. Hopefully in the near future |
ok @wraithgar thanks! |
Sorry to resurrect this, but I'm experiencing a seemingly similar situation:
This is for an app built into a
Any insights would be welcome. Thanks. |
Also having this issue. Any solution please?
|
Hi all - I have a node server which runs fine under forever, and will 'start' under PM2, however, as soon as the first request hits the server - the PM2 errors out with the message...
Script index.js had too many unstable restarts (15). Stopped. "errored"
I'm starting the server in 'forked' mode (under node v0.10.31) with the following...
NODE_ENV=production pm2 start index.js -xn 'myapp'
The error log file contains...
node: ../deps/uv/src/unix/core.c:701: uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed.
The only thing that's a little different about this server, is that it's listening on two ports (there are two node createServer commands each on a different port - one for api access and the other for gui access)
Any ideas?
The text was updated successfully, but these errors were encountered: