request / request

🏊🏾 Simplified HTTP request client.
Apache License 2.0
25.68k stars 3.16k forks source link

ETIMEDOUT occured periodically. #1778

Closed uzysjung closed 5 years ago

uzysjung commented 9 years ago

Hi, I found some issue which request lib didn't disconnect well It causes ETIMEDOUT periodically -- request version ^2.62.0 node version 0.12.7

Error: ETIMEDOUT
    at null.<anonymous> (/var/app/current/node_modules/request/request.js:818:15)
    at wrappedCallback (/var/app/current/node_modules/newrelic/lib/transaction/tracer/index.js:347:23)
    at wrapped (/var/app/current/node_modules/newrelic/lib/transaction/tracer/index.js:157:28)
    at wrappedCallback (/var/app/current/node_modules/newrelic/lib/transaction/tracer/index.js:438:66)
    at wrapped [as _onTimeout] (/var/app/current/node_modules/newrelic/lib/transaction/tracer/index.js:157:28)
    at Timer.listOnTimeout (timers.js:119:15)
150916/172259.405, [request,error:], data: ETIMEDOUT

It works fine only during 30min ~ 60min. but certain amount of time is reached, all request are ETIMEDOUT during 0.1~0.2sec and then It works fine only during 30~60min. and over and over

after I replace request library to node.js http.request it works fine. there's no ETIMEDOUT.

when I used forever options:true , certain amount of time is longer than I didn't.


I have relay servers.

client --- relay server(using request library) --- A server

this is relay server code below.

function (request,reply) {

    var options = {
        url: "A server URL",
        qs: request.query, 
        timeout: config.request.timeout,
    };
    request(options, function (error, response, body) {
        if (error) {
            reply(error);
            return;
        } else if (200 != response.statusCode) {
            reply(new Error('can not get user-reco - statusCode' +response.statusCode));
            return;
        }
        var result = JSON.parse(body);
        reply(result);
    });
}
calibr commented 9 years ago

what value of timeout do you use? and if you can provide complete isolated example it would be very useful.

uzysjung commented 9 years ago

I used 3s , 5s , 10s , default value this issue occurred all environments.

kxjhcs commented 8 years ago

when i send l amount of requests, I have the same problem.

print this always, { Error: ETIMEDOUT at Timeout._onTimeout (C:\Users\Administrator\Desktop\yunnan\node_modules\request\request.js:772:15) at tryOnTimeout (timers.js:224:11) at Timer.listOnTimeout (timers.js:198:5) code: 'ETIMEDOUT', connect: false } 13535 { Error: ETIMEDOUT at Timeout._onTimeout (C:\Users\Administrator\Desktop\yunnan\node_modules\request\request.js:772:15) at tryOnTimeout (timers.js:224:11)

mdumrauf commented 8 years ago

Same problem here

kilianc commented 7 years ago

+1

FredKSchott commented 7 years ago

Can anyone share code that we can use to reproduce / track this down? It's impossible to say what's happening here with the stack trace alone

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.