client hungs if server goes down
denveloper opened this issue · 2 comments
hi,
I am n00b in node.js and evaluating memcached component (less n00b in memcached :) ). The problem if I have the following situation:
withing one request
- code successfully sets or gets something from memcached
- memcached server goes down (and even can return, main action - connection lost)
- code tries to get agan using same memcached and ... HUNGS :(
full sample code is here: https://gist.github.com/denisspb/40246d48c51125869e53
it simply creates item, sleeps to allow me to kill memcached, tries to get again and I never get any error or anything.
I tried to play with different retry/timeout/reconnect settings but this did not help.
also it seems despite of "remove:false" code still remove server from rotation (but not 100% confident, just do not see that this setting is used anywhere)
is something wrong with my code or there is issue with component?
There are a lot of settings. Try something like:
timeout: 9000,
idle: 30000,
retries: 0,
failures: 5,
retry: 30000,
failuresTimeout: 300000,
remove: false,
reconnect: 120000
The key is 0 retries. If you had 1 retry and these same settings, that could lead to up to 9000ms * 2 = 18s of waiting before the second try fails. When it fails, you'll get an error back in your callback and will need to handle it.
@ianshward thank you for your tips. unfortunately this was first that i tried and this did not help. I actually do not see code that executes callback in case of failure (only "issue" is fired but not callback specified in get() ).
i made such change denveloper@c17fe5c
to fire get call back. Is this wrong?