hiredis icon indicating copy to clipboard operation
hiredis copied to clipboard

Replace getaddrinfo with getaddrinfo_a in asynchronous API

Open zh1029 opened this issue 3 years ago • 1 comments

Recently, we meet one issue that process running in containers against k8s infrastructure was stuck in redisAsyncConnect(). According to the traceback. it is stuck at getaddrinfo(). So shall we use getaddrinfo_a() instead of getaddrinfo() for the redis asynchronous API?

zh1029 avatar Jul 08 '21 03:07 zh1029

I used getaddrinfo_a for another project recently, so I think it is worth looking into.

That said, IMHO the interface isn't great. The way it works is by spawning a kernel thread (that you can't join from the application) to do the lookup(s) themselves. Additionally, it is not possible to cancel until the lookups either fail or succeed, meaning that a failure state will still require the application to block for the thread before we can safely exit.

Don't get me wrong, it is an improvement for sure but those limitations are worth noting.

michael-grunder avatar Aug 26 '22 17:08 michael-grunder