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
SSL error #1903
Comments
I just encountered this same issue on request 2.65.0/node 5.1.1 |
Temporary fix for request#1903
Same for me. |
I had a similar issue here today, but unrelated to SSL: TypeError: Cannot read property 'emit' of null request v2.69.0 / Node v5.9.0. |
I am also seeing this, though I think for me it's happening on sockets that have been returned to the pool, possibly only after a redirect. request v2.72.0 / node v6.2.0 |
I've been observing this happening in my CI's as well, in the context of NPM failing :). Is there anything I can do to help address the issue? 90258 verbose stack TypeError: Cannot read property 'emit' of null |
Same issue |
Trying to create a simple repro - reuse of sockets and redirects to different hosts seem to be a factor. |
Here's a simple repro: var http = require('http')
var request = require('request')
var options = {
// Redirects to http://localhost2:3000/node-requests-test/hello
url: "http://localhost1:3000/node-requests-test/redirect",
forever: true
}
// Doesn't repro if keepAlive: false
options.agent = new http.Agent({ keepAlive: true });
request(options)
// Wait...
setTimeout(_ => {}, 10000000) Output (my own changes to request.js):
Server is an IIS ASP.NET server that redirects from /node-requests-test/redirect to /node-requests-test/hello. Changing the server's connection timeout directly corresponds with when the client exception occurs, and only repros if keep-alive is enabled on the server. Looks like the error handler listener for the redirect isn't getting removed. |
@mscdex and @mikeal, I know it was forever ago but are you able to explain the purpose of connectionErrorHandler? You added it in /pull/293. Code today: // Function for properly handling a connection error
function connectionErrorHandler(error) {
var socket = this
if (socket.res) {
if (socket.res.request) {
socket.res.request.emit('error', error)
} else {
socket.res.emit('error', error)
}
} else {
socket._httpMessage.emit('error', error)
}
} I can't find any record of what socket.res is, and as far as I can tell in _http_client.js in core, socketErrorListener already emits error on the ClientRequest (_httpMessage) so I don't see why we'd need to here. |
@zarenner I don't remember, that was 4 years ago :-). However, the http parser error bubbling fix has existed now in node for quite a long time. Because of that fact, the changes in that other PR shouldn't even be necessary anymore AFAIK. |
@mscdex Thanks, assumed that would be the case. On another note, I think there might be additional potential problems with some of the listeners on the Request getting added multiple times on redirect. edit: Looks like #2028 addresses those issues. |
…nErrorHandler Remove connectionErrorHandler to fix #1903
Request version 2.64.0
Node: v4.0.0
Most HTTPS requests work but there's some type of SSL or network error that's causing me grief: TLSSocket can cause a connection error before socket._httpMessage is set. So connectionErrorHandler has an uncaught exception:
request/request.js:80
socket._httpMessage.emit('error', error)
^
TypeError: Cannot read property 'emit' of null
at TLSSocket.connectionErrorHandler (node_modules/request/request.js:80:24)
at TLSSocket.g (events.js:260:16)
at emitOne (events.js:82:20)
at TLSSocket.emit (events.js:169:7)
at emitErrorNT (net.js:1250:8)
at doNTCallback2 (node.js:429:9)
at process._tickCallback (node.js:343:17)
The text was updated successfully, but these errors were encountered: