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

Ensure that reading from error queue does not hang if the socket is in a blocking mode or ::recvmsg returns 0 #114

Merged
merged 2 commits into from
Feb 3, 2024

Conversation

smtrfnv
Copy link
Contributor

@smtrfnv smtrfnv commented Jan 19, 2024

It appears that Linux kernel v3.10 behaves differently from newer kernel versions:

  1. Call to ::recvmsg(socket, &msg, MSG_ERRQUEUE); can be blocking
  2. Call to ::recvmsg(socket, &msg, MSG_ERRQUEUE); can also return 0.

This PR fixes such behavior and adds some test cases for that.

@smtrfnv smtrfnv marked this pull request as draft January 19, 2024 13:50
mattrm456
mattrm456 previously approved these changes Jan 19, 2024
Copy link
Contributor

@mattrm456 mattrm456 left a comment

Choose a reason for hiding this comment

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

OK to merge. I assume we also want to check the control message arena does not contain any control messages, even when recvmsg(MSG_ERRQUEUE) returns 0, to handle edge cases in those Linux kernel versions that have suspicious support for the error queue for TCP sockets, like Linux 3.10.

@smtrfnv smtrfnv changed the title Ensure that reading from error queue does not hang if the socket is n a blocking mode or ::recvmsg returns 0 Ensure that reading from error queue does not hang if the socket is in a blocking mode or ::recvmsg returns 0 Jan 26, 2024
@smtrfnv smtrfnv marked this pull request as ready for review January 26, 2024 15:02
@smtrfnv smtrfnv force-pushed the robust_reading_error_queue branch from 31a023a to 31915ca Compare January 26, 2024 15:05
@mattrm456 mattrm456 merged commit 07c817e into bloomberg:main Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants