memcached icon indicating copy to clipboard operation
memcached copied to clipboard

Calling get() on down server hangs

Open JakSprats opened this issue 9 years ago • 7 comments

the simplest way to reproduce this is to simply run: $ node simple_get.js in the ./examples directory

since I dont have a server at 10.211.55.5 the request should fail, instead it hangs I also used memcache-urls ['127.0.0.1:11211', '127.0.0.1:11212'] when running a local memcache, the first url works, the second hangs

JakSprats avatar Oct 06 '15 21:10 JakSprats

i tried it, it throws an error after few minutes for me.

koldkoder avatar Nov 04 '15 07:11 koldkoder

I will eventually timeout, but the default config/setup does not behave as I would expect if server is down.

sveisvei avatar Apr 29 '16 11:04 sveisvei

I agree this is not expected. It will eventually give an ERROR but it takes way to long. In my code i typically have to start a timer event and if i do not get a result in x amount of time I callback(err, null)

wonderdogone avatar May 18 '16 05:05 wonderdogone

Any solution to solve this issue ? I am also facing the same issue. It waits for 100 seconds before throwing error.

monishavictor avatar Jun 21 '16 15:06 monishavictor

Hello, First of all thank you for your great work on this module ! I have exactly the same behavior as monishavictor, it waits for 100 seconds before throwing the error... It would be great to have the possibility to set a timeout shorter than this value. Thanks !

sylvain-a avatar Feb 06 '17 17:02 sylvain-a

I got the same issue on this situation. (Try connecting to a down server and get nothing but hangs with a thrown error in quite long time)

ghost avatar Jan 29 '18 14:01 ghost

The connection timeout is handled by the Jackpot dependency. There are separeate options to change the connection timeout behaviour, they can be used in the constructor options argument:

  , retries: 5              // Connection pool retries to pull connection from pool
  , factor: 3               // Connection pool retry exponential backoff factor
  , minTimeout: 1000        // Connection pool retry min delay before retrying
  , maxTimeout: 60000       // Connection pool retry max delay before retrying
  , randomize: false        // Connection pool retry timeout randomization

see: https://github.com/3rd-Eden/memcached/blob/master/lib/memcached.js#L88-L92

wouterb avatar Feb 08 '19 12:02 wouterb