We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
redcon version: 1.4.4
POC
package main import ( "context" "log" "strings" "github.com/go-redis/redis/v9" "github.com/tidwall/redcon" ) func main() { redcon := redcon.NewServerNetwork("tcp", "127.0.0.1:12345", func(conn redcon.Conn, cmd redcon.Command) { switch strings.ToLower(string(cmd.Args[0])) { case "set": log.Println(string(cmd.Args[1]), string(cmd.Args[2])) conn.WriteString("OK") default: log.Println("cmd not implemented: ", string(cmd.Args[0])) conn.WriteError("ERR unknown command '" + string(cmd.Args[0]) + "'") } }, nil, nil, ) ch := make(chan error) go func() { redcon.ListenServeAndSignal(ch) }() if err := <-ch; err != nil { log.Fatal(err) } // create redis client, test set command client := redis.NewClient(&redis.Options{ Addr: redcon.Addr().String(), Network: redcon.Addr().Network(), }) r := client.Set(context.Background(), "tmp", "test", 0) if r.Err() != nil { log.Fatal(r.Err()) } if err := client.Close(); err != nil { log.Fatal(err) } // close redcon (race) if err := redcon.Close(); err != nil { log.Fatal(err) } } // go run -race poc.go
The race occurs when closing redcon while the handle function is not finished (invoking c.wr.Flush, but without lock).
handle
c.wr.Flush
The text was updated successfully, but these errors were encountered:
I believe this to be fixed in v1.4.5.
Sorry, something went wrong.
No branches or pull requests
redcon version: 1.4.4
POC
The race occurs when closing redcon while the
handle
function is not finished (invokingc.wr.Flush
, but without lock).The text was updated successfully, but these errors were encountered: