Uh oh!
There was an error while loading. Please reload this page.
std: Fix sub-second Condvar::wait_timeout_ms - #27373
Merged
Merged
Conversation
rust-highfive
commented
Jul 29, 2015
Contributor
(rust_highfive has picked a reviewer for you, use r? to override) |
alexcrichton
commented
Jul 29, 2015
MemberAuthor
cc @carllerche r? @brson Also nominating for beta as this is a somewhat serious bug |
alexcrichton
commented
Jul 29, 2015
MemberAuthor
cc @sfackler |
MemberAuthor
There was a problem hiding this comment.
I figured that gettimeofday won't return a value that is 1 away from overflowing, but we don't control seconds + sys_now.tv_sec so that still needs to be checked.
Member
There was a problem hiding this comment.
It will if you set your system clock that way :P
Contributor
There was a problem hiding this comment.
I agree with @sfackler. The bad input is possible and should be accounted for.
The API we're calling requires us to pass an absolute point in time as an argument (`pthread_cond_timedwait`) so we call `gettimeofday` ahead of time to then add the specified duration to. Unfortuantely the current "add the duration" logic forgot to take into account the current time's sub-second precision (e.g. the `tv_usec` field was ignored), causing sub-second duration waits to return spuriously.
alexcrichtonforce-pushed
the
fix-wait-timeout-ms
branch
from
July 29, 2015 17:25
9803374 to
43b2c47Comparealexcrichton
commented
Jul 29, 2015
MemberAuthor
Updated to use |
brson
commented
Jul 29, 2015
Contributor
@bors: r+ |
bors
commented
Jul 29, 2015
Collaborator
📌 Commit 43b2c47 has been approved by |
Manishearth added a commit
to Manishearth/rust
that referenced
this pull request
Jul 29, 2015
…=brson The API we're calling requires us to pass an absolute point in time as an argument (`pthread_cond_timedwait`) so we call `gettimeofday` ahead of time to then add the specified duration to. Unfortuantely the current "add the duration" logic forgot to take into account the current time's sub-second precision (e.g. the `tv_usec` field was ignored), causing sub-second duration waits to return spuriously.
Merged
alexcrichton
commented
Jul 29, 2015
MemberAuthor
@bors: p=1 (merging to beta) |
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 freeto 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.
The API we're calling requires us to pass an absolute point in time as an
argument (
pthread_cond_timedwait) so we callgettimeofdayahead of time tothen add the specified duration to. Unfortuantely the current "add the duration"
logic forgot to take into account the current time's sub-second precision (e.g.
the
tv_usecfield was ignored), causing sub-second duration waits to returnspuriously.