go-redis icon indicating copy to clipboard operation
go-redis copied to clipboard

HELLO command not supported for twemproxy RESP2 protocol

Open rizqitiket opened this issue 2 years ago • 13 comments

Expected Behavior

When we do client.Ping() command through twemproxy, it should return PONG as success value or error with message. This is just sample of my expectation if succeed without error. Screen Shot 2023-05-30 at 18 03 17

Current Behavior

When we do client.Ping() command through twemproxy, it return error EOF. And in the nutcracker logs, it said the hello command is unsupported yet. Screen Shot 2023-05-30 at 18 01 46 Screen Shot 2023-05-30 at 18 02 10

Possible Solution

I checked the code, it's called at here https://github.com/redis/go-redis/blob/master/redis.go#L288-L301 maybe we can add handler for EOF error, but still not sure if this EOF error type can be occured on other case or my case only

Steps to Reproduce

  1. Run redis on local using default config
  2. Run twemproxy on local using default config
  3. Do redisClient.Ping() using go-redis latest version (mine is using v9.0.5)

Context (Environment)

I want to use go-redis v9 with twemproxy, but it return EOF which is not handled yet by go-redis pkg, so currently i downgrading the pkg version to v8 to avoid this hello command issues

Detailed Description

Still not determined

Possible Implementation

Still not determined

rizqitiket avatar May 31 '23 07:05 rizqitiket

@monkey92t Send Hello Version only if Version is greater than 2? How do you think?

ljun20160606 avatar Jun 05 '23 02:06 ljun20160606

Hello should be acceptable for any redis server after version 6.0. Ideally this would continue to be available to servers even with a value of 2 - and many (others) of us rely on the current behaviour. Making HELLO optional/disableable when a Version is set would be an alternative...

chayim avatar Jun 05 '23 11:06 chayim

I found that there are some magic logic like ReadTimeout -2 indicates that doesn't set timeout. Maybe we can make protocol -1 mean that doesn't send Hello.

ljun20160606 avatar Jun 07 '23 01:06 ljun20160606

@monkey92t Send Hello Version only if Version is greater than 2? How do you think?

what version do you mean? is it the RESP version? if yes, official docs said Redis version 6 and above supports two protocols: the old protocol, RESP2, and a new one introduced with Redis 6, RESP3.

I found that there are some magic logic like ReadTimeout -2 indicates that doesn't set timeout. Maybe we can make protocol -1 mean that doesn't send Hello.

hmm, if looking the value, is supported only 2 or 3. can we make it 2 instead of -1? https://github.com/redis/go-redis/blob/0bdc7dd8986e4923b3309f880245b9311d09f273/options.go#L48C2-L50

rizqitiket avatar Jun 07 '23 02:06 rizqitiket

2 is not a good choice. Since redis-server may default RESP version to 3 in the future. That's why @chayim suggest that make HELLO optional.

ljun20160606 avatar Jun 07 '23 09:06 ljun20160606

can we make sure if protocol options is not used at somewhere? to prevent any unexpected error

rizqitiket avatar Jun 07 '23 11:06 rizqitiket

Hi everybody,

We also have the same problem :( We use twemproxy in production, and we can't upgrade to v9, because of it.

mariaefi29 avatar Jun 26 '23 14:06 mariaefi29

I can appreciate the change - but I'm a bit torn. TWEMPROXY can continue to use V8 - and we could push V9+ to be Redis 6+. Given the redis release cycle, (6.0, 6.2, 7.0, and soon 7.2rc*) have been release since the last 5.0 release in 2021 - my gut says this is the right decision.

chayim avatar Jul 02 '23 11:07 chayim

I can appreciate the change - but I'm a bit torn. TWEMPROXY can continue to use V8 - and we could push V9+ to be Redis 6+. Given the redis release cycle, (6.0, 6.2, 7.0, and soon 7.2rc*) have been release since the last 5.0 release in 2021 - my gut says this is the right decision.

Even though 5.0 was released a long time ago, there are still a large number of services that have not been upgraded to 6.0 for various reasons, and I think it's important to allow users of these services to still be able to connect to the server using the latest version of the go-redis library. Using special logic for compatibility would at least make it easier for users to connect to older versions of the server by modifying the configuration, rather than having to fall back to an old version of the library and recompile the binary.

wzxjohn avatar Sep 19 '23 11:09 wzxjohn

redis 5 is rather old, and doesn't receive security updates for CVEs at this time. Newer versions do. I believe that we should neither invest in, nor ongoingly support these changes. @uglide @ofekshenawa thoughts?

chayim avatar Dec 13 '23 13:12 chayim

I'm with @chayim on this one. Twemproxy is abandonware. There are many variable and properly supported options to replace Twemproxy in 2023. For existing legacy projects, Go-Redis V8 can be used.

uglide avatar Dec 21 '23 13:12 uglide

Hello guys, eventually I remove the twemproxy to avoid this issue.

However, if you wanna ask why i'm not still using V8 for legacy or current project (that use twemproxy) because when i use another pkg that has redis required lib, sometimes it use latest version (V9 above). So my choice is only:

  • fix this HELLO command issue for twemproxy RESP2 protocol, or
  • Don't use twemproxy at all

both choices will allow me to upgrade the version to V9😁 feel free to close this issue since mine is solved

rizqitiket avatar Dec 22 '23 02:12 rizqitiket