hibiken / asynq

Simple, reliable, and efficient distributed task queue in Go
MIT License
10k stars 714 forks source link

[BUG] connect error when use older redis (undex7.2.x) #826

Open Raindrifter opened 9 months ago

Raindrifter commented 9 months ago

Describe the bug when connect to older redis (undex7.2.x) , will report error.

To Reproduce go.mod : asynq v0.24.1 go-redis/v9 v9.5.0

Expected behavior

Screenshots

asynq: pid=34328 2024/02/20 05:44:55.832563 WARN: recoverer: could not list lease expired tasks: INTERNAL_ERROR: redis eval error: ERR Unknown subcommand or wrong number of arguments for 'setinfo'. Try CLIENT HELP
asynq: pid=34328 2024/02/20 05:44:55.870496 ERROR: Dequeue error: UNKNOWN: redis eval error: ERR Unknown subcommand or wrong number of arguments for 'setinfo'. Try CLIENT HELP
asynq: pid=34328 2024/02/20 05:44:55.919511 ERROR: Failed to write server state data: UNKNOWN: redis command error: SADD failed: ERR Unknown subcommand or wrong number of arguments for 'setinfo'. Try CLIENT HELP
asynq: pid=34328 2024/02/20 05:44:55.952470 WARN: recoverer: could not reclaim stale aggregation sets in queue "default": INTERNAL_ERROR: redis eval error: ERR Unknown subcommand or wrong number of arguments for 'setinfo'. Try CLIENT HELP

Environment (please complete the following information):

Raindrifter commented 9 months ago

Related issue: redis/go-redis#2910
redis/go-redis#2911

temp resolve: opt.DisableIndentity = true


type FixedRedisClientOpt struct {
    Addr     string
    Password string
    DB       int
}

func (opt FixedRedisClientOpt) MakeRedisClient() interface{} {
    return redis.NewClient(&redis.Options{
        Addr:             opt.Addr,
        Password:         opt.Password,
        DB:               opt.DB,
        DisableIndentity: true,
    })
}

asynq.NewClient(FixedRedisClientOpt{Addr: "localhost:6379", Password: "password", DB: 0})
kamikazechaser commented 9 months ago

Known bug with v9.5.0. If you are using Redis elsewhere or sharing a connection pool, you can expect this problem. We will hold off on bumping go-redis in this library for now.