-
Notifications
You must be signed in to change notification settings - Fork 865
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
Fixed: incorrect waiting for timeout in blocking-but-timeout mode send/receive functions #1057
Merged
maxsharabayko
merged 12 commits into
Haivision:master
from
ethouris:dev-thread-logging-fix-timeout
Jan 23, 2020
Merged
Fixed: incorrect waiting for timeout in blocking-but-timeout mode send/receive functions #1057
maxsharabayko
merged 12 commits into
Haivision:master
from
ethouris:dev-thread-logging-fix-timeout
Jan 23, 2020
Conversation
This file contains 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
ethouris
added
Impact: Heavy
[core]
Area: Changes in SRT library core
Priority: High
Type: Bug
Indicates an unexpected problem or unintended behavior
labels
Jan 9, 2020
and m_PassCond to m_BufferLock and m_BufferCond
The only place affected is the garbage collector thread. On Linux it used to wait for 10 us, on Windows - 1 millisecond. Now 1 millisecond on both platforms.
ethouris
force-pushed
the
dev-thread-logging-fix-timeout
branch
from
January 20, 2020 16:24
b978cac
to
a71a9d6
Compare
maxsharabayko
requested changes
Jan 22, 2020
maxsharabayko
approved these changes
Jan 23, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, all good.
wait_until()
returns false on timeout, and true if signaled or spurious.
On timeout can break the while loop due to the expiry time is reached.
ethouris
pushed a commit
to ethouris/srt
that referenced
this pull request
Jan 24, 2020
maxsharabayko
pushed a commit
that referenced
this pull request
Jan 24, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[core]
Area: Changes in SRT library core
Priority: High
Type: Bug
Indicates an unexpected problem or unintended behavior
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.
This fixes the bug that has been introduced with timeout waiting in blocking mode with timeout setup for sending and receiving.
BEFORE: If the timeout was set up, then the CV waiting function was waiting for the time set up as timeout since the moment when the call is to be made - as it was in the
while
loop, it means that in case of spurious signals (or meaning something else), which caused the conditions to be re-checked and possibly waiting loop re-entered, the next waiting call started to wait again for the time of timeout since the moment the loop was reentered, not since the moment when the sending/receiving function was called.EXAMPLE PROBLEM:
Result: The function is waiting this time for 3.5s, while according to the configuration it should return with EAGAIN after 2s.
FIX: In point 6, waiting is done not for a relative time, but up to the given fixed point in time, which is calculated in the beginning as the function entrance time plus the configured timeout. So, in this case, as the fixed timeout timepoint is precalculated, in this case it would be distant by 0.5s from now, so it will exit after 0.5s, effectively 2s since the function entrance.