Skip to content

fix modules coredump due to data race in shm_manager #87

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ros/ros_comm/roscpp/include/ros/subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ class ROSCPP_DECL Subscription : public boost::enable_shared_from_this<Subscript

std::vector<PublisherLinkPtr> get_publisher_links()
{
boost::mutex::scoped_lock lock(publisher_links_mutex_);
return publisher_links_;
}
};
Expand Down
4 changes: 2 additions & 2 deletions ros/ros_comm/roscpp/src/libros/shm_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void ShmManager::threadFunc()
if (g_config_comm.topic_white_list.find(topic) !=
g_config_comm.topic_white_list.end() ||
shm_map_.find(topic) != shm_map_.end() ||
(*it)->get_publisher_links().size() == 0)
(*it)->getNumPublishers() == 0)
{
continue;
}
Expand Down Expand Up @@ -243,7 +243,7 @@ void ShmManager::threadFunc()

// Block needs to be allocated
if (read_index == sharedmem_transport::ROS_SHM_SEGMENT_WROTE_NUM ||
shm_map_[topic].shm_sub_ptr->get_publisher_links().size() == 0)
shm_map_[topic].shm_sub_ptr->getNumPublishers() == 0)
{
{
boost::mutex::scoped_lock lock(shm_map_mutex_);
Expand Down
1 change: 1 addition & 0 deletions ros/ros_comm/roscpp/src/libros/topic_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ SubscriptionPtr TopicManager::lookupSubscription(const std::string& topic)

L_Subscription TopicManager::getAllSubscription()
{
boost::mutex::scoped_lock lock(subs_mutex_);
return subscriptions_ ;
}

Expand Down