-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
RESP3 causes RedisServerException only (P|S)SUBSCRIBE / (P|S)UNSUBSCRIBE / PING / QUIT are allowed in this context #2783
Comments
I'll investigate the failure - no idea what broke there! To disable subscription in RESP2, put |
(update: working with @philon-msft to see if there's an Azure Redis Enterprise thing going on here) |
RESP3 support was introduced to Redis Enterprise in 7.2, so that would be the issue here. You can upgrade your instance to 7.2 (which is currently in Preview), or revert to using the RESP2 connection, I'd recommend disabling subscribe if you aren't using any subscribe channels and are ok missing those uptime events from the multiplexer. It will cut the number of connections to the proxy in half (and could reduce the number of connections to your shards by more than that depending on your deployment size). |
Thanks for investigating. I can look into implementing these solutions. However, even with the version mismatch, does it make sense that the server could get into a state where it only accepts PSUBSCRIBE etc if I never call subscribe? Also, if the server is not on a version that accepts RESP3, shouldn't the client be falling back to RESP2? |
@slorello89 that still sounds like a library bug, though; we're meant to be detecting the outcome of the HELLO attempt. I need to investigate this and make it not break so spectacularly. |
@mgravell aye, this is odd, the @shwallmic - are you doing something odd like trying to subscribe over the ad-hoc interface? e.g. db.Execute("SUBSCRIBE", "test"); // subscribing over the interactive connection is connection altering
db.StringSet("foo", "bar"); // now the connection is unusable so we get your error. that's the only way I can reproduce this error. |
(we actually send |
Got it, regardless, I can see that the connection is RESP2:
|
We don't call SUBSCRIBE in our code. I've connected to the server and run INFO commandstats. it shows that SUBSCRIBE has never been called. INFO commandstats Commandstatscmdstat_psync:calls=9,usec=5088,usec_per_call=565.33 Maybe something else is going on. Could something happen to the connection (too many timeouts for example?) that could cause it to get into a state that requires the connection to QUIT / reconnect? |
I will need to investigate. However, for now the workaround is simple: don't try to enable RESP3 on this setup, since the server doesn't support it. |
@mgravell |
Some hosted services such as azure redis broadcast service data on known channels, that the library can listen too. There are also library-specific maintenance channels, which will be triggered if using the library for things like switching primary nodes. |
I have an application that is communicating with Azure Redis Enterprise (running version 6.0). I wanted to reduce the number of connections opened to the Redis Server, so I switched to using RESP3 protocol. However, now the application gets into a state that all commands result in error:
"Error while incrementing key TROR5646ed02-5ddf-45f8-92d0-6a2709b83b98|Exception:StackExchange.Redis.RedisServerException: ERR Can't execute 'evalsha': only (P|S)SUBSCRIBE / (P|S)UNSUBSCRIBE / PING / QUIT are allowed in this context\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at StackExchange.Redis.RedisDatabase.d__223.MoveNext()"
My application never calls Subscribe, so it's unclear to me how the client / server gets into this bad state.
The text was updated successfully, but these errors were encountered: