Handle ENOTCONN#102
Conversation
Unset socket under the condition ENOTCONN this could happen in the event the datadog agent is restarted and using a unix socket file.
| bad_socket = !@socket_path.nil? && ( | ||
| boom.is_a?(Errno::ECONNREFUSED) || | ||
| boom.is_a?(Errno::ECONNRESET) || | ||
| boom.is_a?(Errno::ENOTCONN) || |
There was a problem hiding this comment.
It might actually be better to not add this and instead relax the retry conditions on this line
dogstatsd-ruby/lib/datadog/statsd.rb
Line 64 in 570f3c0
to just
if retries <= 1In our case as well as I'm sure in many others, we'd much rather immediately retry establishing the socket and resending the message rather than losing the message and having to wait for the next one for the socket to re-establish itself.
There was a problem hiding this comment.
Good idea, I changed the logic to retry the same message upon ENOTCONN
gmmeyer
left a comment
There was a problem hiding this comment.
this looks good to me! thanks a lot for doing this! 😄
|
Hey @gmmeyer, thanks for merging this! Is there a standard release schedule you follow? Just wondering when I should update our agents to pull this in. |
|
Also, just realized @blaines, you never removed the original version of your code. There's a return block after that if so your change to retry isn't actually ever going to get reached. :/ |
Unset socket under the condition ENOTCONN this could happen in the event the datadog agent is restarted and using a unix socket file.