Skip to content

Commit

Permalink
Fix deadlock between PDP and StatefulReader (#871)
Browse files Browse the repository at this point in the history
* Fix deadlock between PDP and StatefulReader

This releases the PDP mutex before calling a function that may try to
acquire the mutex on a StatefulReader.

Signed-off-by: Shane Loretz<[email protected]>
Signed-off-by: Shane Loretz <[email protected]>

* Removing unnecessary lock().
  • Loading branch information
sloretz authored and richiware committed Nov 21, 2019
1 parent b5ae9e9 commit b9f2f74
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cpp/rtps/builtin/discovery/participant/PDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ CDRMessage_t PDP::get_participant_proxy_data_serialized(Endianness_t endian)
void PDP::check_remote_participant_liveliness(
ParticipantProxyData* remote_participant)
{
std::lock_guard<std::recursive_mutex> guard(*this->mp_mutex);
std::unique_lock<std::recursive_mutex> guard(*this->mp_mutex);

if(GUID_t::unknown() != remote_participant->m_guid)
{
Expand All @@ -1007,6 +1007,7 @@ void PDP::check_remote_participant_liveliness(
std::chrono::microseconds(TimeConv::Duration_t2MicroSecondsInt64(remote_participant->m_leaseDuration));
if (now > real_lease_tm)
{
guard.unlock();
remove_remote_participant(remote_participant->m_guid, ParticipantDiscoveryInfo::DROPPED_PARTICIPANT);
return;
}
Expand Down

0 comments on commit b9f2f74

Please sign in to comment.