Menu

#1 Hangs up on RST packet receipt and on invalid protocol response by redis

2.0
closed
None
2014-08-27
2014-08-23
No

ARedis hangs up everytime it receives an RST packet from the redis server (can be caused by connection problems, etc.). It also hangs up whenever the redis server returns a response that is not in redis protocol (can be caused by a misconfigured load balancer, network problems, etc.).

We can detect that the redis client hungs up by putting a timeout on getting the Future object being returned by aredis but we will never get its state since Future.get() will never return anything. Exceptions aren't thrown as well.

Do we have checking for these instances? I also tested this by connecting aredis to cynic.

Discussion

  • Suresh Mahalingam

    I have checked in a fix for aredis code hanging upon a Server side reset. The issue was that java was indicating an EOF on read whereas I was expecting an error. Please checkout the latest aredis source, build using ant and check.

    Regarding wrong response format, it is not normally expected since TCP protocol provides a reliable data transfer.

    However I did a quick check by running examples/Basic.java in aredis against a web server and a memcached server and got null results with no hanging of the client.

    aredis is designed for network interruptions but is not for handling incorrect server responses. However if you face an issue with aredis hanging and can tell me how to reproduce it I will try and fix it.

    Thanks,
    Suresh

     
    • Balazs Fark

      Balazs Fark - 2014-11-24

      HI Suresh,

      We faced the following problem with aredis driver 1.0.3. Once Redis was down e.g. it crashed, or some network issue has happened, aredis driver started to consume significant amount of CPU, which remained after Redis came back.

      I did testing with a build from the SVN head and our issue cannot be reproduced anymore. When do you plan to cut release 1.0.4 including Ticket-1? We would like to use an official released version instead of build from SVN head.

      Thank you!

      Balazs

       
  • Suresh Mahalingam

    The fix for aredis hang on redis server closing the connection is checked in and will go in the next release 1.4.

    Note that this bug will not show up in the present 1.3 release due to a timeout setting in redis conf. That is because aredis sets its idle timeout 0.5 seconds less than the server side timeout if configured. This will cause aredis to automatically re-connect an idle connection before redis closes it.

     
  • Suresh Mahalingam

    • status: open --> closed
    • assigned_to: Suresh Mahalingam
     

Log in to post a comment.