Fix datarace on WriterProxy stop while TimedEvent being triggered [16341]#3097
Merged
MiguelCompany merged 6 commits intomasterfrom Dec 13, 2022
Merged
Fix datarace on WriterProxy stop while TimedEvent being triggered [16341]#3097MiguelCompany merged 6 commits intomasterfrom
MiguelCompany merged 6 commits intomasterfrom
Conversation
jsan-rt
suggested changes
Dec 7, 2022
Signed-off-by: Juan López Fernández <juanlopez@eprosima.com>
Signed-off-by: Juan López Fernández <juanlopez@eprosima.com>
This reverts commit b18a5272dd8f7d2bc1f01eda0134b8d572ea86a1.
Signed-off-by: Juan López Fernández <juanlopez@eprosima.com>
d3a4b3a to
8f7bc26
Compare
Contributor
|
@richiprosima please test this |
jsan-rt
previously approved these changes
Dec 9, 2022
|
@richiprosima please test this |
Member
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
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 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
This PR is a revision of #3046, in which the data race between
WriterProxy::stopandperform_initial_acknackwas addressed by forcing the thread invoking the former to wait for the completion of the latter. However, a deadlock may occur as the reader waiting for the event to end does so withEndpoint::mp_mutexlocked, which is also locked when sending an acknack atperform_initial_acknack.Two different solutions are suggested:
StatefulReaderwhich is taken before reader's, and released after modifying the writer proxy's state and before waiting for the executing event to finish.WriterProxy, and locking it again after doing so. This solution implies thatStatefulReader::matched_writer_addandStatefulReader::matched_writer_removemay no longer be executed "atomically", a relevant change that should be carefully analyzed.In addition, this PR also addresses the potential (rarely or never seen in our tests) datarace that may occur between
WriterProxy::stopandperform_heartbeat_response, asStatefulReader::send_acknackreads attributes fromWriterProxywhich are modified when being stopped.Contributor Checklist
versions.mdfile (if applicable).Reviewer Checklist