Description
In our redis configuration:
timeout: 7 seconds
Whenever the connection is closed from the redis end, we are able to catch the end event because of the timeout.
But in some cases (most probably redis is closing the connection without notifying the client) we see the command queue getting piled up and requests are taking too much time to get the response [till the time node-redis client able to sense the close event]. In all such cases command callback is returned with this error Redis connection gone from close event.
even after so much waiting.
Issue seems to be similar to this - http://code.google.com/p/redis/issues/detail?id=368
Is there a way to specify that execution of a command [sending and receiving a reply back] should not exceed the threshold and reply with an error in that case, instead of making the client stall. When we run the node-redis on debug mode we are clearly able to see the client getting stalled with the requests getting piled up in the command queue. We logged the why
and queue length inside flush_on_error function. We have kept offline_queuing disabled. Or is there anyother way of triggering close event in such cases like socket_timeout?
Sample Log
Redis connection is gone from close event.
offline queue 0
command queue 8
Response time of failed request
{2012-07-11 08:06:48.306] [INFO] Production - {"debug":[{"time":"2012-07-11T08:06:17.918Z","data":"xxxx"},{"time":"2012-07-11T08:06:17.918Z","data":"xxxredis"},{"time":"2012-07-11T08:06:48.306Z","data":{"xxxxrediserror":"Redis connection gone from close event."}},{"time":"2012-07-11T08:06:48.306Z","data":{"YYY"}}],"responsetime":"30388 ms"}
Usual Resonse time
{"debug":[{"time":"2012-07-11T08:21:21.241Z","data":"xxxx"},{"time":"2012-07-11T08:21:21.241Z","data":"xxxxredis"},{"time":"2012-07-11T08:21:21.242Z","data":{"xxxxredisreply":"hai","xxxxrediserror":null}},{"time":"2012-07-11T08:21:21.242Z","data":"yyy"},{"time":"2012-07-11T08:21:21.242Z","data":{"xxxxredisreply":"YYY","xxxxrediserror":null}},{"time":"2012-07-11T08:21:21.242Z","data":{"YYY"}}],"responsetime":"1 ms"}