hiredis
hiredis copied to clipboard
Resource Temporarily Unavailable In redisAsyncCommand
Hello, I've implemented a C++ async wrapper around the async hiredis API using the following example as a starting point:
https://github.com/ryangraham/hiredis-boostasio-adapter
Everything works fine the vast majority of the time, but there are occasional errors that trigger a disconnect with the context error context->errstr
saying Resource Temporarily Unavailable
. Before the disconnect the last callback fails with the null
reply.
The redis instance does not show any signs of crashing... I've tracked down the error to ssl.c:457
, so it appears to be related to not having the data be available yet. I could implement a retry on my end and handle it that way - except why does the disconnect
callback get triggered?
It appears that the disconnect is the expected behavior. My understanding at this point is that it is upon me to retry all calls that were reported as have failed.
Is it possible to communicate back a special error code from hiredis
indicating the issue is EAGAIN
or EWOULDBLOCK
, because those are not critical problems necessitating a disconnect. Maybe I am wrong on this, but I expected hiredis
to retry "under the hood" - instead of failing every pending callback.
Hi @ayeganov, I didn't write the SSL layer but it does feel like a Resource Temporarily Unavailable
error should be handled like EAGAIN
for an async context.
I'll dig into the logic and see if that's something we can do. Do you have any tips for triggering that condition on purpose?
@michael-grunder I am trying to figure out how to trigger EAGAIN
myself. Some options I see:
- Simulate the connection socket, but you would have to basically implement some portions of the redis protocol before issuing the error causing the
EAGAIN
- Mock up the call to
redisGetReply
with this library https://github.com/meekrosoft/fff
But have not thought fully through each option yet. I feel like I am missing a much simpler solution to this problem.
@ayeganov Are you still having problems with this?
I'm not sure this is exactly relevant. But I'm having the same error using the redis-client ruby library when trying to connect over tls via an AWS NLB to an elastic cache redis 7. Using the pure ruby driver works just fine