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

rqt_rviz crashes due to rqt threading change #1042

Open
mikepurvis opened this issue Aug 23, 2016 · 5 comments
Open

rqt_rviz crashes due to rqt threading change #1042

mikepurvis opened this issue Aug 23, 2016 · 5 comments

Comments

@mikepurvis
Copy link
Member

Previous discussion: ros-visualization/rqt#96

My understanding is that in the case of rqt_rviz, we now have two threads both calling default ROS callbacks:

However, it's not clear to me what CBs are getting called by VisualizationManager::onUpdate, because almost everything seems to funnel through one of these two NHs which already have explicit callback queues set:

  update_nh_.setCallbackQueue( context_->getUpdateQueue() );
  threaded_nh_.setCallbackQueue( context_->getThreadedQueue() );

The onUpdate call happens on the QT thread, and is set up here:

  update_timer_ = new QTimer;
  connect( update_timer_, SIGNAL( timeout() ), this, SLOT( onUpdate() ));

So I think the source of the problem is there's something registered on the default callback queue which is expecting to be able to do QT state mutation, and now can't (under rqt_rviz) because that callback sometimes occurs on the thread which was added in ros-visualization/rqt#95.

Is there some way to audit the callbacks which are ending up on the different queues? IMO the fix here is going to be:

  • Switch the onUpdate spinOnce call to be an explicit queue invocation.
  • Find out which callbacks are getting called on that spinner, and switch the relevant NodeHandle instances to the explicit queue.

I believe this would turn the async spinner supplied by rqt into a no-op, and restore order in rviz land.

@wjwwood @abencz @sromberg

@wjwwood
Copy link
Member

wjwwood commented Aug 24, 2016

Is there some way to audit the callbacks which are ending up on the different queues?

Not that I'm aware of.

Switch the onUpdate spinOnce call to be an explicit queue invocation.

Sounds like a good idea.

Find out which callbacks are getting called on that spinner, and switch the relevant NodeHandle instances to the explicit queue.

What is "that spinner" in this context? If you mean the spinner in onUpdate, why would you need to switch things away from that?

@mikepurvis
Copy link
Member Author

I want to switch anything presently on that spinner to go to the explicit queue for it so that nothing is being run by the catch-all async spinner.

@wjwwood
Copy link
Member

wjwwood commented Aug 24, 2016

I'd search for uses of NodeHandle within rviz, and make sure none of them use the singleton which doesn't have a custom callback queue setup. I don't think any form of runtime auditing would be complete enough.

@mikepurvis
Copy link
Member Author

I had been starting here: https://github.com/ros-visualization/rviz/search?q=NodeHandle

A bunch are tests of course, and it seems that several of the tools (point_tool, goal_tool) have their own NodeHandle, but that should be harmless, since it's only being used to advertise topics, and therefore has no callbacks.

@wjwwood
Copy link
Member

wjwwood commented Aug 24, 2016

Be careful, the GitHub search does not return all matches, only the first few per file. I'd highly recommend using a local search of the code with grep or your editor of choice.

@wjwwood wjwwood added this to the untargeted milestone Oct 18, 2016
@wjwwood wjwwood removed this from the untargeted milestone May 10, 2018
130s pushed a commit to 130s/rviz that referenced this issue Aug 21, 2024
…ization#1040) (ros-visualization#1042)

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
(cherry picked from commit 384d9c60def93e38ac4c01ddbed17a4731bc4424)

Co-authored-by: Alejandro Hernández Cordero <alejandro@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants