Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There's a bug in libs/exasock/socket/common.h that corrupts the timeout parameters set on exasock sockets. The following line occurs twice in this file:
This is a static cast from a timeval pointer to a timespec pointer.
Here's how timeval is defined in the GNU C library:
And here's the definition of timespec:
The two problems with this are:
tv_usecandtv_nsecare implementation defined. In the GNU C library, they're the same (long int), but these could be different types altogether in another implementation.The consequence of this bug is that timeouts set to any value less than a second are essentially ignored. For instance, a timeout of 900,000 microseconds (900 milliseconds) is treated like a timeout of 900,000 nanoseconds (900 microseconds). Since the resolution of the CLOCK_MONOTONIC_COARSE system timer is on the order of milliseconds on Linux (e.g., see https://upvoid.com/devblog/2014/05/linux-timers/), a timeout parameter < 1 millisecond has little meaning/predictability.
This pull request suggests a minimal changeset to fix the bug. It has been tested on a Linux system and confirmed correct.
Resolves Issue #84