Skip to content
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

Distance segfault #642

Merged
merged 14 commits into from
Oct 6, 2020
Merged

Distance segfault #642

merged 14 commits into from
Oct 6, 2020

Conversation

nkoenig
Copy link
Contributor

@nkoenig nkoenig commented Oct 1, 2020

This PR attempts to resolve #631 and fixes ROS bag recording on the simulation server. A docker image based on this is available using osrf/subt-virtual-testbed:cloudsim_sim_issue_631.

Nate Koenig added 13 commits September 28, 2020 12:23
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>
Copy link
Contributor

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick comments, haven't ran it yet

# docker is run
RUN mkdir -p subt_ws/src \
&& cd subt_ws/src \
&& git clone https://github.com/osrf/subt -b distance_segfault
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to reset this branch before merging.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we didn't want this part merged as is, right?

@@ -576,6 +590,13 @@ GameLogicPlugin::~GameLogicPlugin()
this->dataPtr->finished = true;
if (this->dataPtr->publishThread)
this->dataPtr->publishThread->join();

if (this->dataPtr->bagThread)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is already done in Finish it may not be necessary to duplicate here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually when running this, I get a segfault because it's trying to join the thread twice for some reason, I have a fix inbound.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at bc03832

Comment on lines 695 to 697
this->dataPtr->rosRecorder.reset(new rosbag::Recorder(recorderOptions));
this->dataPtr->bagThread.reset(new std::thread(
&GameLogicPluginPrivate::RosBag, this->dataPtr.get()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this->dataPtr->rosRecorder.reset(new rosbag::Recorder(recorderOptions));
this->dataPtr->bagThread.reset(new std::thread(
&GameLogicPluginPrivate::RosBag, this->dataPtr.get()));
this->dataPtr->rosRecorder = std::make_unique<rosbag::Recorder>(recorderOptions);
this->dataPtr->bagThread = std::make_unique<std::thread>([&](){
this->dataPtr->rosRecorder->run();
});

I think you can save yourself a member function here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also did this in bc03832 since I was in there.

Signed-off-by: Michael Carroll <michael@openrobotics.org>
Copy link
Contributor

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are good with my changes then LGTM. I tested via both /subt/finish service as well as just terminating the launch process and both ended with valid rosbags.

I think just the branch needs to be updated in the Dockerfile before merging.

Copy link
Contributor

@angelacmaio angelacmaio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR resolves an important issue and, in consideration of the code freeze, has been thoroughly tested to make sure it does not cause any new issues. This is approved to merge.

@angelacmaio angelacmaio merged commit 8409752 into master Oct 6, 2020
@nkoenig nkoenig deleted the distance_segfault branch December 10, 2020 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants