I'm spawning child processes using .fork(). I think the problem occurs when a forked process has a database connection open when the parent dies, I'll try to make a few tests.
On Friday, June 8, 2012 9:10:16 PM UTC-3, Ben Noordhuis wrote: > > On Fri, Jun 8, 2012 at 9:41 PM, Rambo <[email protected]> wrote: > > Does anyone know how to deal with this kind of thing? > > I have process A that forks 3 processes, but when an exception occurs in > > process A and it's not caught, it never dies and stays like a zombie > waiting > > for something... > > Somehow the forked processes are preventing the parent process from > exiting. > > > > After trying different approaches, I found this "hack" and seems to > work: > > > > process.on('uncaughtException', function(e) { > > logger.logError(e); > > console.trace(); > > process.exit(1); > > }); > > process.on('exit', function() { > > // kill each forked process using .kill() > > }); > > > > Is there a cleaner way to do this? what about SIGTERM, SIGKILL, etc > events? > > How are you spawning the child processes and what does `ps -A -o > state,comm | grep '[n]ode'` print? > > If the parent process is in Z(ombie) mode, it means that *its* parent > process failed to reap it. > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
