pgte / fugue

Unicorn for node.js
MIT License
396 stars 14 forks source link

Error Spawning due to out of control child process generation #3

Closed okbreathe closed 13 years ago

okbreathe commented 13 years ago

I'm getting the following error running an Express application with Fugue:

pipe(): Too many open files
child_process:212
  var fds = this.fds = this._internal.spawn(path, args, cwd, envPairs, customF
                                      ^
Error: Error spawning
    at ChildProcess.spawn (child_process:212:39)
    at child_process:9:15
    at /home/XXXX/.npm/.npm/fugue/0.0.35/package/lib/fugue.js:313:48
    at ChildProcess.<anonymous> (/home/XXXX/.npm/.npm/fugue/0.0.35/package/lib/fugue.js:320:13)
    at ChildProcess.emit (events:27:15)
    at ChildProcess.onexit (child_process:168:12)
    at node.js:772:9

I think it happens very quickly as every time I've checked on the application its only spawned two workers (as per my config) - so I've never observed it ballooning to 200+ instances.

pgte commented 13 years ago

Hi.

Can you please provide node.js version, OS and fugue.start arguments?

Thanks.

okbreathe commented 13 years ago

Sorry - I was a bit tired when writing that.

node - v0.2.4 OS - Ubuntu 10.4 (2.6.32-22-generic-pae #36-Ubuntu) Fugue - fugue.start(app, config.port, null, 2, {daemonize: true, log_file: __dirname + "/log/fugue.log"});

pgte commented 13 years ago

Thanks for your feedback.

When daemonizing all weird shit starts happening: (see the comments on http://slashed.posterous.com/writing-daemons-in-javascript-with-nodejs-0 ) and I'm getting impredictable behaviour on several applications.

This has not been an issue for me because I use upstart. (See instructions for node.js + upstart here: http://howtonode.org/deploying-node-upstart-monit ).

Since on several OSs the node.js event loop gets borked when forking, I will be removing support from node.js for daemonizing. Daemonizing will have to be done externally to node.js, but it's quite easy.

Also I recently did some tests and corrections on the new 0.0.36 version, so I recommend you upgrade your fugue version.

If you do, remove daemonizing and the problem persists, please reopen this ticket.

Thanks.

okbreathe commented 13 years ago

Hi - thanks for the info. I tried running fugue without the daemonize option and still encountered the same error. This is on fugue v.0.36

fugue.start(app, config.port, null, 4, { log_file: __dirname + "/log/fugue.log"});
pgte commented 13 years ago

does the problem happen on app start or on restart (SIGUSR2)?

okbreathe commented 13 years ago

This is on app start.

arpunk commented 13 years ago

Im hitting the same error:

pipe(): Too many open files

child_process:212
  var fds = this.fds = this._internal.spawn(path, args, cwd, envPairs, customF
                                      ^
Error: Error spawning
  at ChildProcess.spawn (child_process:212:39)
  at child_process:9:15
  at /export/services/node/lib/node/.npm/fugue/0.0.36/package/lib/fugue.js:320:48
  at ChildProcess.<anonymous> (/export/services/node/lib/node/.npm/fugue/0.0.36/package/lib/fugue.js:327:13)
  at ChildProcess.emit (events:27:15)
  at ChildProcess.onexit (child_process:168:12)
  at node.js:772:9

On OS X / Solaris 10 / OpenIndiana, under node 0.2.4 / fugue 0.0.36.

My startup code is:

fugue.start(app, 4001, null, 2, {verbose : true, log_file : __dirname + "/log/production.log", master_pid_path : __dirname + '/tmp/pids/master.pid'});
pgte commented 13 years ago

Thanks for the reports. This should now be fixed on version 0.0.37.

arpunk commented 13 years ago

Thanks! Awesome work

pgte commented 13 years ago

You can post here if the issue doesn't seam solved. Thanks.