Thanks to visit codestin.com
Credit goes to github.com

Skip to content

trigger() blocks forever - bug? #146

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

Closed
CodeFinder2 opened this issue Feb 17, 2020 · 2 comments · Fixed by #193
Closed

trigger() blocks forever - bug? #146

CodeFinder2 opened this issue Feb 17, 2020 · 2 comments · Fixed by #193

Comments

@CodeFinder2
Copy link

Hi,

I am facing the problem that

    ROS_ERROR("FOO");
    visual_tools->trigger();
    ROS_ERROR("BAR");

does not return. Even when Rviz connects, nothing will happen. I don't know if this is related to my issue but note that neither visual_tools->loadMarkerPub(false, true); nor visual_tools->loadMarkerPub(true, true); is working. (I am requiring latched topics.)

Once I comment this block:

  // Check if connected to a subscriber
  if (!pub_rviz_markers_waited_ && !pub_rviz_markers_connected_)
  {
    ROS_DEBUG_STREAM_NAMED(LOGNAME, "Waiting for subscribers before publishing markers...");
    waitForSubscriber(pub_rviz_markers_);

    // Only wait for the publisher once, after that just ignore the lack of connection
    pub_rviz_markers_waited_ = true;
  }

in the implementation of RvizVisualTools::publishMarkers() (invoked by trigger()), it is working fine.

Is this a bug? IMHO, there should be the possibility to skip the waitForSubscriber().

@CodeFinder2
Copy link
Author

CodeFinder2 commented Feb 17, 2020

Okay, nevermind: it is related to the ros::spinOnce() in RvizVisualTools::waitForSubscriber(). I have previously locked a mutex and if spinOnce() invokes a callback (locking the mutex again), it deadlocks.

So, would it be possible to skip waitForSubscriber()? Probably adding an additonal parameter?

@mfocchi
Copy link

mfocchi commented Nov 19, 2020

Me and all my research group have the exact same issue. Is it going to be fixed? In which version?

jspricke added a commit to jspricke/rviz_visual_tools that referenced this issue Aug 2, 2021
waitForSubscriber used to call ros::spinOnce() which could trigger
callbacks from other topics in other threads. In case those have a lock
to only get called once, this would look the visual_tools thread.

Closes: PickNikRobotics#146
JafarAbdi pushed a commit that referenced this issue Oct 5, 2022
waitForSubscriber used to call ros::spinOnce() which could trigger
callbacks from other topics in other threads. In case those have a lock
to only get called once, this would look the visual_tools thread.

Closes: #146
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants