-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
socket.server is not defined #5083
Comments
Okay so I've narrowed it further down and the behavior changed between the releases 2.3.1 and 2.3.2. Here is code to reproduce: var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('./server.key'),
cert: fs.readFileSync('./server.crt')
};
var server = https.createServer(options, function(req, res) {
res.writeHead(200);
res.end('hello world\n');
}).listen(8111);
server.on('connection', function(connection) {
console.log('connection.server', connection.server);
// undefined in 2.3.2, and defined in 2.3.1
}); Looks like the behavior changed between commit 6c61ca5 and 9180140 . |
And specifically here: 9180140#diff-04c3a6bcf355f2e05e7700c1b253d475R377 |
Should also be noted that the with "http" |
/cc @indutny |
Okay @unusualbob and I have worked out a test case for this here: #5106 |
Looking. |
The role of `this.server` is now split between `this._server` and `this.server`. Where the first one is used for counting active connections of `net.Server`, and the latter one is just a public API for users' consumption. The reasoning for this is simple, `TLSSocket` instances wrap `net.Socket` instances, thus both refer to the `net.Server` through the `this.server` property. However, only one of them should be used for `net.Server` connection count book-keeping, otherwise double-decrement will happen on socket destruction. Fix: nodejs#5083
Should be fixed by #5262, thank you! |
The role of `this.server` is now split between `this._server` and `this.server`. Where the first one is used for counting active connections of `net.Server`, and the latter one is just a public API for users' consumption. The reasoning for this is simple, `TLSSocket` instances wrap `net.Socket` instances, thus both refer to the `net.Server` through the `this.server` property. However, only one of them should be used for `net.Server` connection count book-keeping, otherwise double-decrement will happen on socket destruction. Fix: #5083 PR-URL: #5262 Reviewed-By: James M Snell <[email protected]>
The role of `this.server` is now split between `this._server` and `this.server`. Where the first one is used for counting active connections of `net.Server`, and the latter one is just a public API for users' consumption. The reasoning for this is simple, `TLSSocket` instances wrap `net.Socket` instances, thus both refer to the `net.Server` through the `this.server` property. However, only one of them should be used for `net.Server` connection count book-keeping, otherwise double-decrement will happen on socket destruction. Fix: #5083 PR-URL: #5262 Reviewed-By: James M Snell <[email protected]>
The role of `this.server` is now split between `this._server` and `this.server`. Where the first one is used for counting active connections of `net.Server`, and the latter one is just a public API for users' consumption. The reasoning for this is simple, `TLSSocket` instances wrap `net.Socket` instances, thus both refer to the `net.Server` through the `this.server` property. However, only one of them should be used for `net.Server` connection count book-keeping, otherwise double-decrement will happen on socket destruction. Fix: #5083 PR-URL: #5262 Reviewed-By: James M Snell <[email protected]>
The role of `this.server` is now split between `this._server` and `this.server`. Where the first one is used for counting active connections of `net.Server`, and the latter one is just a public API for users' consumption. The reasoning for this is simple, `TLSSocket` instances wrap `net.Socket` instances, thus both refer to the `net.Server` through the `this.server` property. However, only one of them should be used for `net.Server` connection count book-keeping, otherwise double-decrement will happen on socket destruction. Fix: #5083 PR-URL: #5262 Reviewed-By: James M Snell <[email protected]>
Recently myself and @braydonf were upgrading a project from 0.10.28 to 4.x and found something our connection tracking logic broke and was causing our server to never shutdown. When investigating I found that the server would never emit the close event even if all sockets had been destroyed.
When looking at net.js I noticed that the server._emitCloseIfDrained won't be called if the connection is missing its
server
property:https://github.com/nodejs/node/blob/v4.2.6/lib/net.js#L482
I decided to check for this property when creating my server
I found that in 0.10.x
socket.server
was defined, but in 4.x it was undefined. I tried to make a test case to replicate it but found I was unable to do so. Luckily @braydonf took another look at it and has managed to replicate it, and is currently tracking down exactly when breakage occurred and said he would follow up on this issue when found. Looks like so far he's narrowed it down to io.js2.2
->2.3
.The text was updated successfully, but these errors were encountered: