Open shakhovv opened 6 years ago
Hi @shakhovv. Thanks for the ticket. I'm able to reproduce this exception locally with the test you've provided. What's curious is that I don't see the exception in the pubsub integration tests. I'll look into this.
I see this with Redis 3.2.12
as well as Redis 4.0.10
.
Did any one solve this problem ?
Hi @hussain21j. I took another look at this recently and the reason the pubsub integration tests work is that the servers they spin up don't require authentication. I think the test @shakhovv posted fails because a new service is created when the client tries to send the subscribe command, and this service has not yet authenticated. The call graph I'm looking at is in SubscribeClient: subscribe calls retry calls doRequest calls RedisPool.forSubscription calls factory.newService.
As far as I can tell, the SubscribeClient isn't allowed to send Auth requests as written. This makes authenticating subscriptions a bit tricky.
Unfortunately work on finagle-redis hasn't been internally prioritized as of late so I'm unsure when a fix will be merged but I'll try to dig in some more. Of course feel free to submit a PR if you find a fix.
I have a proof of concept for a patch. We can authenticate before we send the subscribe command in SubscribeDispatcher.apply and handle the case of receiving a StatusReply (authentication successful) in SubscriptionManager.onMessage. The fix isn't this simple because it requires some extra machinery that will store the password provided on the first Auth command and pass it to SubscribeDispatcher.apply, but in theory this is possible.
The problem with the above approach is that it requires storing and passing around the password between the client and the subscribe dispatcher. Here are some other ideas:
As I mentioned earlier we aren't prioritizing work on finagle-redis internally and we've decided to not fix this unless it gets more attention. Hopefully there's enough detail here so that a motivated external user can pick up from here and submit a patch, if desired.
I'll be interested to work on this.
Hi All,
I'm using version 20.4.1. When creating the redis client using the withPassword option I'm able to authenticate on the fly. The issue now, is that whenever I run a subscribe command with auth enabled I get java.lang.IllegalArgumentException: Not a subscribe/unsubscribe command at com.twitter.finagle.redis.exp.SubscribeDispatcher.apply(SubscribeDispatcher.scala:54)
I believe the issue is that SubscribeDispatcher is receiving an Auth command before receiving the Subscribe command. When this happens there is a catch all for non-subscribe commands that throws the exception. Has anyone else seen this issue or been able to work around it?
We tried use subscribe command with auth in redis and got this error:
NOAUTH Authentication required
.Expected behavior
Should work subscribe without errors in finagle-redis with auth
Actual behavior
My app can't make any subscription and we got this exception in log:
Steps to reproduce the behavior
We use this environment:
finagle-redis: 18.6.0
redis: 4.0.9
Test: