-
Notifications
You must be signed in to change notification settings - Fork 140
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
Handle ENOTCONN #102
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.
@@ -52,6 +52,7 @@ def write(message) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
if retries <= 1 && boom.is_a?(IOError) && boom.message =~ /closed stream/i |
to just
if retries <= 1
In 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I changed the logic to retry the same message upon ENOTCONN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.