smira / go-statsd

Go statsd client library with zero allocation overhead, great performance and reconnects
MIT License
109 stars 18 forks source link

Closing a client with invalid host hangs forever #19

Closed vthiery closed 5 years ago

vthiery commented 5 years ago

Hi!

I ran into a weird issue running this piece of code:

package main

import (
    "log"

    "github.com/smira/go-statsd"
)

func main() {
    client := statsd.NewClient("BOOM:BOOM")
    if err := client.Close(); err != nil {
        log.Fatalf("could not close, but got error: %v", err)
    }
    log.Print("all good!")
}

It hangs forever (apparently) saying:

[STATSD] 2019/05/15 18:33:38 [STATSD] Error connecting to server: dial udp: address udp/BOOM: unknown port

I would have expected Close() to return an error, maybe telling me the address is incorrect or that it cannot be resolved.

smira commented 5 years ago

confirmed, thanks for reporting!

smira commented 5 years ago

1.3.1 is published now with the fix

vthiery commented 5 years ago

1.3.1 is published now with the fix

Wow that was fast! Thanks a lot!