-
Notifications
You must be signed in to change notification settings - Fork 230
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
Buffer for reading udp packets is too small. #35
Comments
You're right, that should definitely be increased and the comment doesn't make too much sense. No idea why it was that low in the first place! See #36 |
Thank you very much! |
The docs default the max size to 512b0 for "open internet" safety concerns. But this can be configured by the admin. This may be something we want to have as a runtime flag if possible. |
Flag is overhead, I think. |
Yea, that seems reasonable. |
512 bytes are ok for the wild Internet. For local network we can send udp packets up to 1432 bytes or greater. For example it's very important if we use buffered client (github.com/cactus/go-statsd-client/statsd/client_buffered.go). So I suggest increasing buf size to 2-8k.
Also MTU is important for client. Udp packet can be split or dropped by ISP because of size. Server shouldn't evaluate MTU.
{code}
func (l *StatsDListener) Listen(e chan<- Events) {
// TODO: evaluate proper size according to MTU
var buf [512]byte
for {
n, _, err := l.conn.ReadFromUDP(buf[0:])
if err != nil {
log.Fatal(err)
}
l.handlePacket(buf[0:n], e)
}
}
{code}
The text was updated successfully, but these errors were encountered: