-
Notifications
You must be signed in to change notification settings - Fork 35
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
TypeError: Cannot read property 'port' of null on cluster.js #42
Comments
I've also been seeing the same error on my console, although the application works properly. |
in fact, this is an issue caused by node's cluster module compare the following: //0.10.7 the reading of tcpSelf.address().port is causing the error, as the net.js uses process.nextTick to emit 'listening' event and address isn't made available yet. in most cases, i don't see it blocking the application though, let us know if otherwise |
So, the solution is.... |
Well, @ijse, since I found another problem in cluster2 module, I decided to not use it. I am using cluster module from node. |
@lucastschmidt Thanks for your advice. What's the problem? I just found it suit my case except the bug. Do you have any other alternatives? |
i could try overwrite the Socket.prototype.address at best in net.js to return none null value to avoid the error message, but doesn't look safe at all. Also, looking at 0.11.x, they have eliminated such need: https://github.com/joyent/node/blob/v0.11.7-release/lib/cluster.js obj.once('listening', function() { |
@ijse I am not using cluster2 because of this bug #43 It was completely insane. Eventually I just used the vanilla http://nodejs.org/api/cluster.html I didnt need anything special, so it was no problem for me. Another thing you could take a look into it is https://github.com/Unitech/pm2 I dont know if this project is active, but good luck! |
@inexplicable |
In case anyone stumbles upon this issue, this monkey-patch at the beggining of worker file helps:
|
Well this was annoying bug (in NodeJS cluster module that is, not this project)... couple hours wasted as I thought my code had a bug. |
Hey, I just started trying this out, and I had an error, described below. The thing is that I thought it had something to do with my code. But then I tried a simple application like the one below and still have this problem. The application works, but I just thought about posting here to see if anyone has any idea about this. Thank you!
var Cluster = require('cluster2');
var express = require('express');
var app = express();
app.get('/', function(req, res) {
res.send('hello');
});
var c = new Cluster({
port: 3000,
cluster: false
});
c.listen(function(cb) {
cb(app);
});
TypeError: Cannot read property 'port' of null
at Server. (cluster.js:569:30)
at Server.g (events.js:175:14)
at Server.EventEmitter.emit (events.js:117:20)
at net.js:1029:10
at process._tickCallback (node.js:415:13)
[email protected]
[email protected]
[email protected]
The text was updated successfully, but these errors were encountered: