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

Sending SIGINT to http cluster causes a SEGFAULT on FreeBSD 10.1 Release #25649

Closed
hbowden opened this issue Jul 8, 2015 · 4 comments
Closed

Comments

@hbowden
Copy link

hbowden commented Jul 8, 2015

This code below causes a segfault when receiving SIGINT or control-c on the command line instead terminating gracefully.

In the first file.

"use strict";

var os = require('os');
var http = require('http');
var cluster = require('cluster');

var createServer = function createServer(opts) {

  var server = {};

 if (cluster.isMaster) {

   var cpuCount = require('os').cpus().length;

   for (var i = 0; i < cpuCount; i += 1) {
     cluster.fork();
   }

   return server;

 } else {

   http.Server(function(req, res) {
      res.writeHead(200);
      res.end("This answer comes from the process " + process.pid);
    }).listen(8080);
  }
}

 module.exports = {

   createServer: createServer,

};

And the second file.

  "use strict";

  var router = require('./prac.js');

  var server = router.createServer();

Running node on the second file and typing control-c should reproduce the segfault.

Here is a link to the core dump: https://mega.co.nz/#!ZEtgmQ7I!ZbLPAve6G6i4evnN2jnHTcVsTDNbTTvax0gqGFCqzKw

Here is some output from valgrind: https://mega.co.nz/#!9dUCyYRa!LrFTHCzQoiUzfrCmeqbRo43UnAuBEFVkipio9uaoi9Q

@misterdjules
Copy link

What version of node did you use to reproduce this problem?

@hbowden
Copy link
Author

hbowden commented Jul 8, 2015

v0.12.0

@misterdjules
Copy link

@2trill2spill Thanks 👍 This seems like a duplicate of #9326, which has been fixed in node v0.12.3. Can you please confirm that upgrading to node v0.12.3 or later fixes this issue?

In the meantime, closing as a duplicate of #9326 but please let us know if upgrading actually fixes your problem.

@hbowden
Copy link
Author

hbowden commented Jul 8, 2015

Updating fixed it, thanks.

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

2 participants