-
Notifications
You must be signed in to change notification settings - Fork 866
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
[core] Fixed proper reporting of sending blocked state. Fixed API value for connect-non-blocking #1698
Draft
ethouris
wants to merge
10
commits into
Haivision:master
Choose a base branch
from
ethouris:dev-fix-group-ut-findings
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
[core] Fixed proper reporting of sending blocked state. Fixed API value for connect-non-blocking #1698
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4a95481
[core] Fixed proper reporting of sending blocked state. Fixed API val…
c272a05
Fixed return 0 on multi-connect call. Added lock-preventive emergency…
834b702
Fixed TSBPD deadlock-prone continuation. Demoted epoll IPE log. Made …
8b4d0b7
Fixed return value from srt_connect for groups
f0d185c
Merge branch 'master' into dev-fix-group-ut-findings
575807b
Apply suggestions from code review
ethouris fa55144
Fixed test that reused a dead socket
4b74a4c
Merged. Upgraded IPE log to Error
ece9a28
Updated constness of arraysize
5572363
Updated to latest upstream
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5744,6 +5744,12 @@ void *CUDT::tsbpd(void *param) | |
tsbpdtime = steady_clock::time_point(); | ||
} | ||
|
||
if (self->m_bClosing) | ||
{ | ||
HLOGC(tslog.Debug, log << "tsbpd: IPE? Closing flag set in the meantime of checking. Exiting"); | ||
break; | ||
} | ||
|
||
if (!is_zero(tsbpdtime)) | ||
{ | ||
const steady_clock::duration timediff = tsbpdtime - steady_clock::now(); | ||
|
@@ -5774,13 +5780,25 @@ void *CUDT::tsbpd(void *param) | |
*/ | ||
HLOGC(tslog.Debug, log << self->CONID() << "tsbpd: no data, scheduling wakeup at ack"); | ||
self->m_bTsbPdAckWakeup = true; | ||
THREAD_PAUSED(); | ||
tsbpd_cc.wait(); | ||
THREAD_RESUMED(); | ||
|
||
bool signaled = false; | ||
while (!signaled) | ||
{ | ||
// For safety reasons, do wakeup once per 1s and re-check the flag. | ||
THREAD_PAUSED(); | ||
signaled = tsbpd_cc.wait_for(seconds_from(1)); | ||
THREAD_RESUMED(); | ||
if (self->m_bClosing) | ||
{ | ||
HLOGC(tslog.Debug, log << "tsbpd: IPE? Closing flag set in the meantime of waiting. Exiting"); | ||
goto ExitLoops; | ||
} | ||
} | ||
} | ||
|
||
HLOGC(tslog.Debug, log << self->CONID() << "tsbpd: WAKE UP!!!"); | ||
} | ||
ExitLoops: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need to exit two loops, and additionally maintain the thread checker. |
||
THREAD_EXIT(); | ||
HLOGC(tslog.Debug, log << self->CONID() << "tsbpd: EXITING"); | ||
return NULL; | ||
|
@@ -7819,15 +7837,22 @@ void CUDT::destroySynch() | |
void CUDT::releaseSynch() | ||
{ | ||
SRT_ASSERT(m_bClosing); | ||
#if ENABLE_HEAVY_LOGGING | ||
if (!m_bClosing) | ||
{ | ||
LOGC(smlog.Debug, log << "releaseSynch: IPE: m_bClosing not set to false, TSBPD might hangup!"); | ||
} | ||
#endif | ||
m_bClosing = true; | ||
// wake up user calls | ||
CSync::lock_signal(m_SendBlockCond, m_SendBlockLock); | ||
|
||
enterCS(m_SendLock); | ||
leaveCS(m_SendLock); | ||
|
||
// Awake tsbpd() and srt_recv*(..) threads for them to check m_bClosing. | ||
CSync::lock_signal(m_RecvDataCond, m_RecvLock); | ||
CSync::lock_signal(m_RcvTsbPdCond, m_RecvLock); | ||
CSync::lock_broadcast(m_RecvDataCond, m_RecvLock); | ||
CSync::lock_broadcast(m_RcvTsbPdCond, m_RecvLock); | ||
|
||
// Azquiring m_RcvTsbPdStartupLock protects race in starting | ||
// the tsbpd() thread in CUDT::processData(). | ||
|
@@ -11192,6 +11217,7 @@ void CUDT::checkTimers() | |
|
||
void CUDT::updateBrokenConnection() | ||
{ | ||
m_bClosing = true; | ||
releaseSynch(); | ||
// app can call any UDT API to learn the connection_broken error | ||
s_UDTUnited.m_EPoll.update_events(m_SocketID, m_sPollID, SRT_EPOLL_IN | SRT_EPOLL_OUT | SRT_EPOLL_ERR, true); | ||
|
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
Oops, something went wrong.
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 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.
Why not just let TSBPD to re-check the receiver buffer even in case of a spurious wake-up?
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.
Actually, yes, might be a better idea. OTOH this 1s delay is too much if that deadlock would have happened when closing a socket in the group receiver.