Skip to content

EOF errors / automatic reconnnect? #25

@dim

Description

@dim

We have EOF issues with v2 with idle connections. Our redis server is configured with timeout, when connections are idle for longer, we get an EOF error on the next request. We tried to lower/set the IdleTimeout option, but it causes a deadlock.

How to reproduce:

  1. Start redis-server with --timeout 5
  2. go run the code snippets below
package main

import (
    "fmt"
    redis "github.com/vmihailenco/redis/v2"
    "time"
)

func main() {
    red := redis.NewTCPClient(&redis.Options{Addr: "localhost:6379"})
    for {
        val := red.Ping()
        fmt.Println(val)
        time.Sleep(6 * time.Second)
    }
}
package main

import (
    "fmt"
    redis "github.com/vmihailenco/redis/v2"
    "time"
)

func main() {
    red := redis.NewTCPClient(&redis.Options{Addr: "localhost:6379", IdleTimeout: 3})
    for {
        val := red.Ping()
        fmt.Println(val)
        time.Sleep(6 * time.Second)
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions