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

[core] Moved post-hs-update locking code out of mutex; untangled lock order around RIDVector #1677

Merged

Conversation

ethouris
Copy link
Collaborator

The problem:

There was detected a deadlock and therefore the synchro parameter introduced, which passes down the call with a requirement to not lock the mutex, while it was causing a deadlock.

After a deep mutex analysis it turned out that the deadlock was actually caused by a mutex lock ordering violation, which has started from the CRendezvousQueue::updateConnStatus, which is called whole under a lock for m_RIDVectorLock. The extra update calls introduced for HSv5 required extra locking, which was in lock ordering violation against this mutex. The problem has been solved by collecting all sockets, that need to be updated in this function by these lockable calls, in a separate container, and then call the updates outside of the lock.

…r protection of RIDVector. Removed lock prevention on asynchro update.
srtcore/core.cpp Outdated Show resolved Hide resolved
@maxsharabayko maxsharabayko added this to the v1.4.3 milestone Nov 30, 2020
@maxsharabayko maxsharabayko added [core] Area: Changes in SRT library core Type: Bug Indicates an unexpected problem or unintended behavior labels Nov 30, 2020
@codecov
Copy link

codecov bot commented Nov 30, 2020

Codecov Report

Merging #1677 (9bb8518) into master (5bc58cd) will decrease coverage by 0.28%.
The diff coverage is 92.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1677      +/-   ##
==========================================
- Coverage   60.64%   60.36%   -0.29%     
==========================================
  Files          78       78              
  Lines       17438    17442       +4     
==========================================
- Hits        10575    10528      -47     
- Misses       6863     6914      +51     
Impacted Files Coverage Δ
srtcore/api.cpp 49.54% <ø> (+0.87%) ⬆️
srtcore/core.h 77.41% <ø> (-3.23%) ⬇️
srtcore/queue.h 87.50% <ø> (ø)
srtcore/sync.h 76.00% <ø> (-2.10%) ⬇️
srtcore/core.cpp 54.09% <66.66%> (-1.19%) ⬇️
srtcore/queue.cpp 82.43% <100.00%> (+0.82%) ⬆️
test/test_enforced_encryption.cpp 91.26% <100.00%> (+0.12%) ⬆️
srtcore/list.cpp 75.65% <0.00%> (-4.35%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bc58cd...c4a07fd. Read the comment docs.

@maxsharabayko maxsharabayko self-assigned this Nov 30, 2020
@maxsharabayko maxsharabayko merged commit 03dafd8 into Haivision:master Nov 30, 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 Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants