Skip to content
New issue

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

Closing a client with invalid host hangs forever #19

Closed
vthiery opened this issue May 15, 2019 · 3 comments · Fixed by #20
Closed

Closing a client with invalid host hangs forever #19

vthiery opened this issue May 15, 2019 · 3 comments · Fixed by #20
Labels

Comments

@vthiery
Copy link

vthiery commented May 15, 2019

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 smira added the bug label May 15, 2019
@smira
Copy link
Owner

smira commented May 15, 2019

confirmed, thanks for reporting!

smira added a commit that referenced this issue May 15, 2019
When `net.Dial()` fails, `sendLoop` iterates in a loop never allowing to
the client to shutdown.

Fixes: #19
@smira smira closed this as completed in #20 May 15, 2019
@smira
Copy link
Owner

smira commented May 15, 2019

1.3.1 is published now with the fix

@vthiery
Copy link
Author

vthiery commented May 15, 2019

1.3.1 is published now with the fix

Wow that was fast! Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants