-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.
Description
in https://github.com/nodejs/node/blob/master/lib/_http_agent.js
you have the code
const newSocket = self.createConnection(options, oncreate);
...
function oncreate(err, s) {
...
if (err)
return cb(err);
...
}
//cb returns us to to
this.createSocket(req, options, function(err, newSocket) {
if (err) {
nextTick(newSocket._handle.getAsyncId(), function() {
req.emit('error', err);
});
...
How can you call _handle on newSocket in case there was an error creating that newSocket?
Looks not right to me.
For example where I run into it:
I have a need in a simple custom .createConnection where I do
this.createConnection = (options, callback) => {
let localhandle = net._createServerHandle(options.localAddress);
if (typeof localhandle === 'number') {
return callback("handle creation error: "+localhandle);
}
...
And since one of your latest releases I'm receiving this error from time to time when localhandle is an error:
TypeError: Cannot read property '_handle' of undefined
at _http_agent.js:186:27
at oncreate (_http_agent.js:230:14)
Metadata
Metadata
Assignees
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.