question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

request get ESOCKETTIMEDOUT

See original GitHub issue

env:

node version v7.10.0
uname -a
Linux iZ2zebqg2v1h2g7jmo9endZ 3.10.0-514.6.2.el7.x86_64 #1 SMP Thu Feb 23 03:04:39 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
request package version: "request": "^2.74.0"

and use express:4.13.4, I find some log:

{ Error: ESOCKETTIMEDOUT
       at ClientRequest.<anonymous> (/data1/baas_server/baas_x37/node_modules/request/request.js:819:19)
       at Object.onceWrapper (events.js:293:19)
       at emitNone (events.js:86:13)
       at ClientRequest.emit (events.js:188:7)
       at Socket.emitTimeout (_http_client.js:679:10)
       at Object.onceWrapper (events.js:293:19)
       at emitNone (events.js:86:13)
       at Socket.emit (events.js:188:7)
       at Socket._onTimeout (net.js:352:8)
       at ontimeout (timers.js:386:14)
       at tryOnTimeout (timers.js:250:5)
       at Timer.listOnTimeout (timers.js:214:5) code: 'ESOCKETTIMEDOUT', connect: false }

I look the source code,get a lot annotation:

 var setReqTimeout = function() {
      // This timeout sets the amount of time to wait *between* bytes sent
      // from the server once connected.
      //
      // In particular, it's useful for erroring if the server fails to send
      // data halfway through streaming a response.
      self.req.setTimeout(timeout, function () {
        if (self.req) {
          self.abort()
          var e = new Error('ESOCKETTIMEDOUT')
          e.code = 'ESOCKETTIMEDOUT'
          e.connect = false
          self.emit('error', e)
        }
      })
    }

so i want to why the reason and how to fix the bug; and i don’t know how to trigger it,i only find it in log or find request is error; thanks;

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:14
  • Comments:26

github_iconTop GitHub Comments

12reactions
cancerberoSgxcommented, Nov 4, 2017

I found if there are too many async requests, then this exception happens in linux. The workaround I’ve found is doing this:

setting this options:

agent: false, pool: {maxSockets: 100}

Now the timeout can be lying so you might need to increase it.

4reactions
liujbcommented, Aug 2, 2017

I have solve the problem, It’s not about the request. Nginx’s problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js request module getting ETIMEDOUT and ...
I'm noticing alot of ETIMEDOUT and ESOCKETTIMEDOUT errors although the links are reachable and respond fairly quickly using chrome. I've limit ...
Read more >
Node.js request module getting ETIMEDOUT and ...
Hello I am having issues when I execute this request account. ... Node.js request module getting ETIMEDOUT and ESOCKETTIMEDOUT.
Read more >
Error: ESOCKETTIMEDOUT with REST request
The request is being processed, we are just not getting our confirmation back and are timing out. We are using node.js with the...
Read more >
NodeJS ETIMEDOUT, ESOCKETTIMEDOUT, ENOTFOUND
So I started to analyze a few things and I noticed that NodeJS request package was VERY slow to perform the DNS resolution...
Read more >
What does ESOCKETTIMEDOUT mean? - Particle Community
oh, and knowing what the particle webhook request (upstream to ... EDIT2: If I change my lambda timeout to 3 seconds then I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found