lettuce icon indicating copy to clipboard operation
lettuce copied to clipboard

Redis Connection Protocol Negotiation Doesn't Handle -NOPROTO

Open JohnSully opened this issue 1 year ago • 1 comments

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.

JohnSully avatar Jul 31 '22 17:07 JohnSully

Do you have more details here since when NOPROTO is being reported any by which Redis server versions?

mp911de avatar Aug 02 '22 08:08 mp911de

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.

mp911de avatar Nov 22 '22 10:11 mp911de