lukevenediger / statsd-csharp-client

A simple c# client library for statsd and statsd.net
MIT License
47 stars 20 forks source link

Socket Exception with TCP #10

Open stefanoric opened 9 years ago

stefanoric commented 9 years ago

The following error is reported to log4net:

Warning: 0 : Sending metrics via TCP failed with a SocketException: A connect request 
was made on an already connected socket, code: IsConnected

To reproduce, let your program run and send metrics. Let it inactive for a few minutes, then stimulate your program again to send metrics. Result: you will see the warnings above and no metrics will get to graphite.

niemyjski commented 9 years ago

Is there any chance you could submit a unit test that reproduces this or a pull request?

stefanoric commented 9 years ago

Well, this seems to require more of an integration test than a unit test. It must be the way the code interacts with .NET network libraries and/or OS networking infrastructure.

stefanoric commented 9 years ago

I'll try to debug into the code tomorrow if I have time.

niemyjski commented 9 years ago

Were you able to debug this? I'm guessing you are getting more than just this error. I work on exceptionless which also supports log4net and I was seeing a ton of network exceptions with just the udp socket. I ended up doing this to solve the problem. I need to port these changes to this library.

Do you think the same should be done for tcp (reset on any exception)

stefanoric commented 9 years ago

We have temporarily switched to UDP (with another client library) since we had urgent test to carry on. I hope to be able to look at it next week.

On Sat, May 2, 2015 at 1:47 PM, Blake Niemyjski notifications@github.com wrote:

Were you able to debug this? I'm guessing you are getting more than just this error. I work on exceptionless https://github.com/exceptionless/Exceptionless which also supports log4net and I was seeing a ton of network exceptions with just the udp socket. I ended up doing this https://github.com/exceptionless/Foundatio/blob/master/src/Core/Metrics/StatsDMetricsClient.cs#L42-L56 to solve the problem. I need to port these changes to this library.

Do you think the same should be done for tcp (reset on any exception)

— Reply to this email directly or view it on GitHub https://github.com/lukevenediger/statsd-csharp-client/issues/10#issuecomment-98353973 .

Stefano Ricciardi http://www.stefanoricciardi.com

niemyjski commented 7 years ago

@stefanoric were you able to look into this?

niemyjski commented 6 years ago

Any updates?