redis / rueidis

A fast Golang Redis client that supports Client Side Caching, Auto Pipelining, Generics OM, RedisJSON, RedisBloom, RediSearch, etc.
Apache License 2.0
2.44k stars 155 forks source link

Error connecting to dragonfly with syntax error #495

Closed vamshiaruru closed 8 months ago

vamshiaruru commented 8 months ago

Hi every, thanks for the great library. Been using rueidis for a while now with redis and my org is considering using dragonfly as a replacement. I brought up dragonfly locally using

  docker run -p 6380:6379 --ulimit memlock=-1 docker.dragonflydb.io/dragonflydb/dragonfly

The version is

I20240312 21:41:01.746660     1 init.cc:70] dragonfly running in opt mode.
I20240312 21:41:01.746815     1 dfly_main.cc:627] Starting dragonfly df-v1.15.1-d6703460242ab8aa415a93f32677c5f23b5e6ec8

and I am running it on mac.

I try to connect to it using

    client, err := rueidis.NewClient(rueidis.MustParseURL("redis://@localhost:6380/0"))
    if err != nil {
        log.Fatalf("error connecting to redis: %v\n", err)
    }

But I get the error syntax error. I am using latest rueidis version (in my go mod github.com/redis/rueidis v1.0.31).

Am I doing anything wrong? Any help is appreciated, thanks!

vamshiaruru commented 8 months ago

Things seem to work fine with the go-redis client, if that helps.

rueian commented 8 months ago

Hi @vamshiaruru,

This may be helpful https://github.com/dragonflydb/dragonfly/issues/2454

vamshiaruru commented 8 months ago

Hi @rueian , thansk for the response. Setting DisableCache to true works! Just to be clear, this means no in memory caching at all right, until dragonfly fixes their issue? Or is there something we can do to just send CLIENT TRACKING ON instead of CLIENT TRACKING ON OPTIN? Also, this means rueidislock with default config won't work either right, we have to disable memory caching there as well?

rueian commented 8 months ago

Hi @vamshiaruru,

Actually, you can let rueidis send just CLIENT TRACKING ON by doing this:

client, err := rueidis.NewClient(rueidis.ClientOption{
    InitAddress:           []string{"127.0.0.1:6379"},
    ClientTrackingOptions: []string{},
})

However, there are two more problems with dragonfly:

  1. It does not support CLIENT CACHING YES, which is a minor issue.
  2. For unknown reason, It crashes on client.DoCache(...) like this:
    I20240313 12:17:42.688308     9 listener_interface.cc:101] sock[7] AcceptServer - listening on port 6379
    *** SIGSEGV received at time=1710332266 on cpu 0 ***
    PC: @     0xaaaae1226770  (unknown)  dfly::Transaction::Refurbish()
    @     0xaaaae187cc7c        480  absl::lts_20230802::AbslFailureSignalHandler()
    @     0xffffacb3b7a0       4960  (unknown)
    @     0xaaaae12ce164        400  facade::Connection::DispatchOperations::operator()()
    E20240313 12:17:46.477110     9 server_family.cc:1532] Subcommand CACHING not supported
    @     0xaaaae12d5164         32  facade::Connection::DispatchFiber()
    @     0xaaaae12d576c        384  boost::context::detail::fiber_entry<>()

So, I think, you must set the DisableCache to work with dragonfly at this moment.

And yes, with DisableCache being set, the client.DoCache(...) will behave exactly the same as the client.Do(...). That is no caching on the client side at all.

rueidislock can work with DisableCache being set but its performance will degrade.

vamshiaruru commented 8 months ago

Understood, thanks for the response. I'll close this issue now.