-
Notifications
You must be signed in to change notification settings - Fork 96
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
Prevent ENOBUFS errors by skipping UDP send buffer size configuration #392
Conversation
9c43823
to
914ea90
Compare
The previous implementation attempted to set the UDP socket's send buffer size, which could lead to ENOBUFS errors in some environments. This change: - Overrides setup_socket in UDPConnection to skip buffer size configuration - Improves socket creation by using the correct address family - Updates error message to be more accurate ("Failed to setup socket") This prevents potential buffer-related errors while maintaining the original functionality for other connection types.
914ea90
to
abed4ff
Compare
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.
Mechanically speaking, this PR is fine - I don't see any obvious errors.
I think this puts us back in the situation of potentially allowing packets that are too big to fit in a buffer? But ... I'm not certain.
I think this is okay though.
def socket | ||
@socket ||= begin | ||
udp_socket = UDPSocket.new | ||
family = Addrinfo.udp(host, port).afamily | ||
udp_socket = UDPSocket.new(family) |
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.
ipv6 support? cool!
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 seems to breaking our stats logging to Datadog. We're on a k8s stack so I'm guessing it's something to do with the IPv6 support? We're investigating now.
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.
We suspect it was due to us using a socat proxy bound to IPv4 only. We proxy through a central Datadog agent that forwards our stats to Datadog.
It will take a bit to update and test across our environments to confirm.
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.
Feel free to put up a PR in case it turns out to be an issue.
Is there any way we could write a regression test here / in Shopify/shopify so that we can verify we won't run into the same problem we ran into when we tried to deploy v 3.9.8? |
# From Ruby >= 3.5, logger is not part of the stdlib anymore | ||
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.5") | ||
gem "logger" | ||
end |
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.
I don't see anything about this in the 3.4 release notes, was this communicated somewhere?
✅ What
🤔 Why
When using UDP connections, the previous implementation attempted to set the socket's send buffer size. This could lead to
Errno::ENOBUFS
errors in certain environments, particularly when the system is under high load or has strict buffer size limitations. By skipping the buffer size configuration for UDP connections specifically, we prevent these errors while maintaining the original functionality for other connection types.Validation
Made sure that we dont see any ENOBUFS in benchmarks (even though this might be related to network layer).
Checklist