bitpay / node-bitpay-client

A Node.js module and command line client for interacting with BitPay's Cryptographically Secure API
102 stars 95 forks source link

Error: ESOCKETTIMEDOUT in request.js #84

Open yogiben opened 7 years ago

yogiben commented 7 years ago

We're getting the following uncaught error originating from request.js

We're using try catch and promises wherever possible.

9xj7
2016-12-05 15:08:18+01:00Error: ESOCKETTIMEDOUT
9xj7
2016-12-05 15:08:18+01:00 at ClientRequest.<anonymous> (/app/bundle/programs/server/npm/node_modules/custom/node_modules/bitpay/node_modules/request/request.js:825:19)
9xj7
2016-12-05 15:08:18+01:00 at ClientRequest.g (events.js:260:16)
9xj7
2016-12-05 15:08:18+01:00 at emitNone (events.js:67:13)
9xj7
2016-12-05 15:08:18+01:00 at ClientRequest.emit (events.js:166:7)
9xj7
2016-12-05 15:08:18+01:00 at TLSSocket.emitTimeout (_http_client.js:575:10)
9xj7
2016-12-05 15:08:18+01:00 at TLSSocket.g (events.js:260:16)
9xj7
2016-12-05 15:08:18+01:00 at emitNone (events.js:67:13)
9xj7
2016-12-05 15:08:18+01:00 at TLSSocket.emit (events.js:166:7)
9xj7
2016-12-05 15:08:18+01:00 at TLSSocket.Socket._onTimeout (net.js:332:8)
9xj7
2016-12-05 15:08:18+01:00 at _runOnTimeout (timers.js:524:11)
9xj7
2016-12-05 15:08:18+01:00 at _makeTimerTimeout (timers.js:515:3)
9xj7
2016-12-05 15:08:18+01:00 at Timer.unrefTimeout (timers.js:584:5)
yogiben commented 7 years ago

Might be related to this

http://stackoverflow.com/questions/24320578/node-js-get-request-etimedout-esockettimedout/37946324#37946324

ajp8164 commented 7 years ago

Socket timeouts not being caught

cancerberoSgx commented 6 years ago

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

setting this options to request():

agent: false, pool: {maxSockets: 100}

Notice that after that, the timeout can be lying so you might need to increase it. Also I think this could be solved by increasing ulimits number of file opened maximum in linux.

OrangeDog commented 6 years ago

@cancerberoSgx if the ulimits were the problem, then the error would be EMFILE

fisher-zh commented 5 years ago

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

setting this options to request():

agent: false, pool: {maxSockets: 100}

Notice that after that, the timeout can be lying so you might need to increase it. Also I think this could be solved by increasing ulimits number of file opened maximum in linux.

but It doesn't work

lucaswxp commented 4 years ago

This still happens to me, nothing seems to work. Too many parallels requests cause this.