-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node@0.12.x udp and pm2 #1204
Comments
Bug confirmed. |
Thanks for reporting this, I'm going to try to find a workaround. |
And it was fixed in joyent/node#v0.12 (https://github.com/joyent/node/pull/8643/files) but it will take a while till it's published. Here is a workaround given by one of the Node.js contributors : var cluster = require('cluster');
var http = require('http');
var dgram = require('dgram');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
} else {
var server = http.createServer(function (request, response) {
var client = dgram.createSocket("udp4");
client.bind({exclusive: true}, function() {
var message = new Buffer("Hello");
client.send(message, 0, message.length, 80, "google.com", function(err, bytes) {
client.close();
});
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
});
server.listen(1337);
} Important part : |
thanks, the workaround works. 👍 |
Hi
Looks like pm2 is acting very weird on
node@0.12.x
when used in cluster mode. On hitting the udp code twice pm2 is orphaning the node process and going stall. This works perfectly fine on plain node.Created this example to show the issue - https://github.com/skoranga/testudpapp
Any idea what's going on?
-sanjeev
The text was updated successfully, but these errors were encountered: