Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Cluster API: worker process can't get 'SIGTERM' signal when being killed #5766

Closed
baoshan opened this issue Jun 30, 2013 · 6 comments
Closed

Comments

@baoshan
Copy link

baoshan commented Jun 30, 2013

cluster = require "cluster"

if cluster.isMaster

  for i in [0...4]
    cluster.fork()

  setTimeout ->
    worker.kill() for id, worker of cluster.workers
  , 2000

else
  process.on 'SIGTERM', ->
    console.log 'SIGTERM'
  setTimeout (->), 100000

Outputs nothing. I think it should log SIGTERM 4 times.

What's wrong with the above code?

@baoshan
Copy link
Author

baoshan commented Jun 30, 2013

I noticed line 420 @ lib/cluster.js

process.once('disconnect', process.exit.bind(null, 0));

Is that line the reason for above behavior?

If worker exits immediately once disconnected, what's the intended use for signal of api worker.kill(sign)?

@trevnorris
Copy link

This belongs on the mailing list. Once an actual bug has been identified open a new issue with said information. Also, post example code in javascript.

@baoshan
Copy link
Author

baoshan commented Jun 30, 2013

Got it!

@trevnorris
Copy link

Thanks. :-)

@hunterloftis
Copy link

@baoshan did you ever figure this out? I'm seeing the exact same thing (and would expect the exact same output as you did).

@hunterloftis
Copy link

Aha: #5832

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants