self.req undefined? - Cannot read property '_reusedSocket' of undefined #417

edsu opened this Issue Jan 18, 2013 · 1 comment

2 participants


I'm putting a lot of traffic through request.get to resolve shortened URLs. I noticed that after my program has run for a bit it throws an exception:

    if (self.req._reusedSocket && error.code === 'ECONNRESET'
TypeError: Cannot read property '_reusedSocket' of undefined
    at ClientRequest.Request.init.self.clientErrorHandler (/home/ubuntu/node_modules/request/main.js:221:17)
    at ClientRequest.EventEmitter.emit (events.js:96:17)
    at Socket.socketOnData (http.js:1435:9)
    at TCP.onread (net.js:404:27)
ubuntu@ip-10-145-181-135:~$ vi /home/ubuntu/node_modules/request/main.js

which looks like self.req is undefined.

It seems non-deterministic, since it fails after processing a few thousand URLs, when fetching a URL ... but the particular URL changes from run to run, with the exact same input.

Any advice would be welcome.

@mikeal mikeal added a commit that referenced this issue Jan 18, 2013
@mikeal mikeal Fix for #417 53c1508
request member

you're getting an error emitted before that actual request goes out. i can't tell what the error is but i know it's before the request actually goes out so this should resolve the throw you're seeing and now you'll get the real error. the real error may still throw since i doubt any handlers have been added to it this early but at least you'll be able to find and debug the real problem.

@mikeal mikeal closed this Jan 18, 2013
@ravi ravi referenced this issue in sylvinus/node-crawler Jul 31, 2013

Upgrade version of Request #61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment