-
Notifications
You must be signed in to change notification settings - Fork 765
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
[14681] Fixing thread sanitizer issue 4169 <master> #2717
Merged
Merged
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
MiguelBarro
changed the title
Test/issue/4169
[14681] Fixing thread sanitizer issue 4169 <master>
Jun 3, 2022
MiguelBarro
force-pushed
the
test/issue/4169
branch
4 times, most recently
from
June 7, 2022 06:00
0fd6978
to
2a28411
Compare
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Javier Santiago <javiersantiago@eprosima.com> Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Javier Santiago <javiersantiago@eprosima.com> Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Javier Santiago <javiersantiago@eprosima.com> Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
…proxy mutex. Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
MiguelBarro
force-pushed
the
test/issue/4169
branch
from
June 7, 2022 06:14
2a28411
to
3bbb195
Compare
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
… fixed Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
…ataExceedsSizeLimit blackbox Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
MiguelBarro
force-pushed
the
test/issue/4169
branch
from
June 8, 2022 10:33
ab98173
to
2e9f756
Compare
13 tasks
Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>
@richiprosima please test mac |
@Mergifyio backport 2.6.x |
✅ Backports have been created
|
mergify bot
pushed a commit
that referenced
this pull request
Jun 22, 2022
* Refs #14285: Trigger workflow Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs #14354: Trigger workflows Signed-off-by: Javier Santiago <javiersantiago@eprosima.com> Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs #14069: Trigger workflow Signed-off-by: Javier Santiago <javiersantiago@eprosima.com> Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs #14069: Workflow trigger Signed-off-by: Javier Santiago <javiersantiago@eprosima.com> Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Fixing issue 4169. Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Fixing compiler errors & warnings. Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Fixing testing Mocks. Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Addressing reviewer comments. Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Debugging fixes. Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Linter pass Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Adding a ProxyPool class to avoid EDP ABBAs on temporary proxy mutex. Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Prevent reentrancy issues on shared_mutexes using tls Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Mock updates to match new RTPSParticipantImpl behavior. Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Linter pass.. Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Fixing gcc/clang warnings Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Fixing clang warnings Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Unifying all temporary proxies in PDP owned pools Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Linter pass Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. RTPSStatisticsTests.statistics_rpts_listener_gap_callback fixed Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. RTPSWriterTests CMakelists.txt fix for windows. Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Fixing clang -Wunused-lambda-capture issue Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Fixing proxies copy to fix PubSubBasic.ReceivedPartitionDataExceedsSizeLimit blackbox Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> * Refs 14681. Addressing reviewer's comments Signed-off-by: Miguel Barro <miguelbarro@eprosima.com> Co-authored-by: Javier Santiago <javiersantiago@eprosima.com> (cherry picked from commit 271929b)
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.
Description
Review and testing against intermediate branch #2704
This pull request addresses the following family of deadlocks
A => B => C => A
where:RecursiveTimedMutex& Endpoint::getMutex()
Endpoint is EDP DataWriter in Participant 2.std::recursive_mutex RTPSParticipantImpl::getParticipantMutex()
std::recursive_mutex RTPSParticipantImpl::getParticipantMutex()
It involves a test case where two participants are destroyed from the Main Thread.
The execution sequence that leads to deadlocks:
A=>B
Flow controller thread for EDP DataWriter in Participant 2.EDP DataWriter sending messages through its flow controller, that is, flow controller's asynchronous thread
(
FlowControllerImpl::run()
). The asynchronous thread takes the DataWriter mutex (A).Later it delivers the sample via intraprocess to EDPDataReader in participant 2 which takes the participant
mutex (B) to traverse endpoint collections and do matching.
B=>C
Main Thread.On test destruction comes participant 1 removal.
Participant 1 calls
RTPSParticipantImpl::disable()
which takes mutex B to traverse it's endpoint list forremoval. Here the EDP demise notifications go via intraprocess and ends up in
EDP::unpairWriterProxy()
call that requires C (participant 2 mutex) for unmatching.
C=>A
Main ThreadOn test destruction comes participant 2 removal.
Participant 2 calls
RTPSParticipantImpl::disable()
which takes mutex C to traverse it's endpoint list forremoval. In order to send
DATA[U]R
message it requires mutex (A) to allocate a new CacheChange (single mutex forhistory and endpoint).
In order to solve the deadlock, the participant's endpoint collections will no longer be protected by the general
participant mutex but by a devoted one (this was partially done before but the refactor extends it to all collections).
Other changes added in this pull request:
temp_data_lock
mutex (devoted to protect EDP temporary proxies access) a new proxy pool is created in EDP. The proxies are then synchronized via ownership instead of mutual exclusion.RTPSParticipantImpl
class in order to prevent reentrancy in theendpoints_list_mutex
(this situation takes place very often in intraprocess calls).Contributor Checklist
versions.md
file (if applicable).Reviewer Checklist