Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


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

edsu opened this Issue · 1 comment

2 participants

Ed Summers Mikeal Rogers
Ed Summers

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 Rogers mikeal referenced this issue from a commit
Mikeal Rogers mikeal Fix for #417 53c1508
Mikeal Rogers

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 Rogers mikeal closed this
Kevin Pullin kppullin referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Ravi Sarma ravi referenced this issue in sylvinus/node-crawler

Upgrade version of Request #61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.