-
Notifications
You must be signed in to change notification settings - Fork 770
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
Fix datarace on WriterProxy stop while TimedEvent being triggered [16341] #3097
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
juanlofer-eprosima
changed the title
Fix datarace on WriterProxy stop while TimedEvent being triggered
Fix datarace on WriterProxy stop while TimedEvent being triggered [16341]
Nov 28, 2022
jsan-rt
suggested changes
Dec 7, 2022
Signed-off-by: Juan López Fernández <[email protected]>
Signed-off-by: Juan López Fernández <[email protected]>
This reverts commit b18a5272dd8f7d2bc1f01eda0134b8d572ea86a1.
Signed-off-by: Juan López Fernández <[email protected]>
jparisu
force-pushed
the
datarace/perform-initial-acknack
branch
from
December 7, 2022 08:50
d3a4b3a
to
8f7bc26
Compare
@richiprosima please test this |
jsan-rt
previously approved these changes
Dec 9, 2022
@richiprosima please test this |
Signed-off-by: Miguel Company <[email protected]>
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::stop
andperform_initial_acknack
was 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_mutex
locked, which is also locked when sending an acknack atperform_initial_acknack
.Two different solutions are suggested:
StatefulReader
which 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_add
andStatefulReader::matched_writer_remove
may 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::stop
andperform_heartbeat_response
, asStatefulReader::send_acknack
reads attributes fromWriterProxy
which are modified when being stopped.Contributor Checklist
versions.md
file (if applicable).Reviewer Checklist