hiredis
hiredis copied to clipboard
Replace getaddrinfo with getaddrinfo_a in asynchronous API
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?
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.