redis / lettuce

Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.
https://lettuce.io
MIT License
5.3k stars 949 forks source link

Connection handshake fails with `ERR unknown command CLIENT, with args beginning with: SETINFO lib-name` #2817

Closed xsolo closed 2 months ago

xsolo commented 2 months ago

Bug Report

Current Behavior

The connection does not work and fails to connect to Google Cloud Redis (Memory Store) v7.2 with the following error CLIENT 'SETINFO'. The Client Setinfo not supported by GCP Redis

Stack trace ```java Exception in thread "main" io.lettuce.core.RedisConnectionException: Unable to connect to IP_ADDRESS/: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:215) at io.lettuce.core.RedisClient.connect(RedisClient.java:200) at com.wayfair.smart.ds587.demo.bt.graphql.RedisTest.main(RedisTest.java:29) Caused by: io.lettuce.core.RedisCommandExecutionException: ERR unknown command 'CLIENT', with args beginning with: 'SETINFO' 'lib-name' 'Lettuce' at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:147) at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:116) at io.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:120) at io.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:111) at io.lettuce.core.protocol.CommandWrapper.complete(CommandWrapper.java:63) at io.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:745) at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:680) at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:597) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Unknown Source) ```

Input Code

Input Code ```java // your code here; ```

Expected behavior/code

Environment

Possible Solution

Additional context

mp911de commented 2 months ago

Have you tried to disable the Client Info via RedisURI.setLibraryName(null)/RedisURI.setLibraryVersion(…)?

The issue with Redis derivatives is that they pretend a specific version that we use to control whether certain functionality is available while the derivative server software doesn't implement the Redis OSS functionality we're looking for.

joexfactor commented 2 months ago

Hi Team,

We are currently facing the same compatibility issue with Lettuce 6.3.2.RELEASE when connecting to Google Cloud Redis (Memory Store) v7.2, an issue that does not occur with the earlier v7.0. We are using Lettuce as a transitive dependency through org.springframework.boot:spring-boot-starter-data-redis:3.2.5.

Could you please provide any advice on potential solutions or workarounds for this issue? Additionally, any information on upcoming fixes or patches would be highly appreciated as it would help us plan our development and maintenance activities better.

xsolo commented 2 months ago

Hi Team,

We are currently facing the same compatibility issue with Lettuce 6.3.2.RELEASE when connecting to Google Cloud Redis (Memory Store) v7.2, an issue that does not occur with the earlier v7.0. We are using Lettuce as a transitive dependency through org.springframework.boot:spring-boot-starter-data-redis:3.2.5.

Could you please provide any advice on potential solutions or workarounds for this issue? Additionally, any information on upcoming fixes or patches would be highly appreciated as it would help us plan our development and maintenance activities better.

I think this is what the reference ticket is about https://github.com/redis/lettuce/pull/2823

tishun commented 2 months ago

Folks,

My bad. You can unblock yourself for now if you manually disable the reporting of the client name and version:

RedisURI redisUri = RedisURI.Builder.redis("my.redis.instance.com", 6379)
   .withLibraryName("")
   .withLibraryVersion("")
   .build();
RedisClient redisClient = RedisClient.create(redisUri);

This should unblock you until 7.x is released and you are able to consume the solution in #2823