title: What happens to the cluster master when all Node workers die?
body: <p>So I have been trying to understand how Node cluster works and I have this code:</p>
  
  <pre><code>const cluster = require('cluster')
  const os = require('os')
  const express = require('express')
  const app = express()
  
  let cpus
  
  // Check to see if the master process is running this
  if (cluster.isMaster) {
      console.log(`Master Process: ${process.pid} is running.`)
  
      // Get the number of CPU's and fork that many workers
      cpus = os.cpus().length
      for(let i = 0; i &lt; cpus; i++) {
          console.log(`Forking process #${i+1}`)
          cluster.fork()
      }
  
      // If worker process is killed log it
      cluster.on('exit', (worker) =&gt; {
          console.log(`Worker ${worker.process.pid} died.`)
      })
  
      // Once a worker is connected output they are online
      cluster.on('online', (worker) =&gt; {
          console.log(`Worker ${worker.process.pid} is online.`)
      })
  
      process.on('SIGINT', () =&gt; {
          for(const id in cluster.workers) {
              cluster.workers[id].kill('SIGINT')
          }
      })
  } else {
      // Each worker should listen on port 3000
      app.listen(3000)
  }
  </code></pre>
  
  <p>When I run this and then exit with <code>Ctrl+C</code> I receive this console output and my master process also dies.</p>
  
  <pre><code>Master Process: 19988 is running.
  Forking process #1
  Forking process #2
  Forking process #3
  Forking process #4
  Worker 14684 is online.
  Worker 14672 is online.
  Worker 12520 is online.
  Worker 3276 is online.
  Worker 3276 died.
  Worker 12520 died.
  Worker 14672 died.
  Worker 14684 died.
  </code></pre>
  
  <p>So it's doing what I'd like it to do, but why does the master process also die when all I'm having <code>SIGINT</code> do is kill the workers? </p>