-
Notifications
You must be signed in to change notification settings - Fork 986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emit Connection Error events #885
Comments
That's an interesting use case. I turned this ticket into an enhancement to emit an event whenever a connection operation fails (initial connect, reconnect). |
When I first implemented the consumption of events, I had thought the ConnectionDeactivatedEvent would give me a reason as to why the disconnect happens. It seems like the that information should be available so maybe that's another enhancement, add a reason to the events, if there is one? |
There's not always a reason associated with a disconnect, or at least, things are not directly related to each other. Typically, an IOException occurs on either reading from or writing to the channel. We can receive exceptions while writing write through the write future. This exception is propagated to the code that invoked a particular Redis command. When reading, we potentially can get hold of an error notification via |
PS: You can register in any case an own |
I forgot to add that after the redis password is reset and a restart since redis requires that, when lettuce reconnects, instead of getting the "ERR invalid password" exception as I'd expect, I get the "NOAUTH Authentication required". So not only am I not able to detect the connection error, but when the connection is retried (I have the auto reconnect on), the error isn't the one I should be getting, since I should actually get invalid password in this case because I haven't triggered a refresh of password cache. I just tried again with 5.1.1 to make sure this wasn't already addressed. |
What wanders on my mind right now is introducing a new event (
|
Yes, a persistent connection issue is what we're looking to detect and so that new event would give us that information. |
Lettuce now emits ReconnectFailedEvent if a reconnect attempt fails along the cause and the retry counter. This event allows detection of persistent reconnect failures.
|
Looks good, I was able to see the new ReconnectFailedEvent when I kept my redis down and then it transferred to a ConnectionActivatedEvent when I started redis back up. All as I would expect. |
This is a feature request, I believe. With 5.1.0 (and using spring-session-data-redis 2.0.5.RELEASE), I'll receive the ConnectionDeactivatedEvent (which isn't at all useful since there is no reason associated with the event) but nothing ever publishes to tell me that there is connection refused, or any other error from redis. We are in the situation where roughly every 90 days, our redis password will be rotated. I need to catch this situation and force a reload of the password cache. However, since I can't get that event from lettuce, I can't handle it. It looks like the watchdog isn't publishing events at all or just not at the lowest point I need.
Example of what I'll see:
The text was updated successfully, but these errors were encountered: