lettuce
lettuce copied to clipboard
Redis Connection Protocol Negotiation Doesn't Handle -NOPROTO
Bug Report
When establishing a connection Lettuce attempts to negotiate the protocol version. The current implementation only checks for "-ERR" and "missing" indicating the hello command is missing. However the hello command itself is designed to return NOPROTO if the requested protocol version isn't available.
Current Behavior
io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379 at io.lettuce.core.RedisConnectionException.create (RedisConnectionException.java:78) at io.lettuce.core.RedisConnectionException.create (RedisConnectionException.java:56) at io.lettuce.core.AbstractRedisClient.getConnection (AbstractRedisClient.java:350) at io.lettuce.core.RedisClient.connect (RedisClient.java:216) at io.lettuce.core.RedisClient.connect (RedisClient.java:201) at com.mycompany.app.App.main (App.java:14) at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:279) at java.lang.Thread.run (Thread.java:829) Caused by: io.lettuce.core.RedisCommandExecutionException: NOPROTO unsupported protocol version
Input Code
The example connection code from lettuce.io on an implementation of the Redis protocol that supports HELLO but not v3.
Expected behavior/code
Fallback to v2 on -NOPROTO
Note that currently all Redis versions with HELLO support v3 so this is not a major issue for most users, however you will need to support this in the future. I hit this during testing of a proxy implementation that abstracts HELLO and doesn't yet have full v3 support.
Do you have more details here since when NOPROTO
is being reported any by which Redis server versions?
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.