Skip to content
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

[MM-42347] Fix UDP conn not respecting deadlines #15

Merged
merged 2 commits into from
Mar 8, 2022
Merged

Conversation

streamer45
Copy link
Collaborator

Summary

PR fixes an issue with the UDP server connection not respecting the defined deadlines and hence potentially getting stuck indefinitely in case of an unreachable host.

After some testing and looking into the standard library I've figure out this was actually caused by the call on File.Fd() we do here:

writeBufSize, err := syscall.GetsockoptInt(int(connFile.Fd()), syscall.SOL_SOCKET, syscall.SO_SNDBUF)
if err != nil {
p.LogError(err.Error())
return err
}
readBufSize, err := syscall.GetsockoptInt(int(connFile.Fd()), syscall.SOL_SOCKET, syscall.SO_RCVBUF)
if err != nil {
p.LogError(err.Error())
return err
}

As suggested in the official documentation we are now using File.SyscallConn() instead which seems to avoid this problem.

Ticket Link

https://mattermost.atlassian.net/browse/MM-42347

@streamer45 streamer45 added the 2: Dev Review Requires review by a core committer label Mar 7, 2022
@streamer45 streamer45 self-assigned this Mar 7, 2022
@streamer45
Copy link
Collaborator Author

@agnivade This is strictly related to the issue I mentioned to you a while back.

@streamer45 streamer45 requested a review from cpoile March 7, 2022 18:12
Copy link
Member

@cpoile cpoile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa, nice debugging!

@agnivade
Copy link
Member

agnivade commented Mar 8, 2022

Yep saw it, nice work!

@streamer45 streamer45 added 3: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels Mar 8, 2022
@streamer45 streamer45 merged commit f42a99e into main Mar 8, 2022
@streamer45 streamer45 deleted the MM-42347 branch March 8, 2022 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants