Repository navigation
move_group.cpp: seg fault bug fix - #426
Conversation
Fixed a bug with casting CallbackQueueInterface * to ros::CallbackQueue * without a check. moveit#425
|
Thank you for the patch! So standard ROS indeed provides another type of callback structure... I don't really like to rely on RTTI to resolve this, but imo it's roscpp's fault for not exposing a processing-method for the queue via the abstract interface... So I don't see a cleaner way to keep all use-cases working. I just checked and RTTI is required in core MoveIt already, but this patch will force user-code, i.e. everything using the MoveGroupInterface, to compile with it too. Granted, it's not something you switch-off everyday though.. I approve the patch. This is a plain bugfix and easy enough to understand. |
|
I'm not familiar with nodelets callback queue / threading model, but don't we run the risk of processing the wrong callback queue using Another option may to to explicitly give a callback queue to the action client on construction and process that queue exactly when desired (of which we will know the exact type, since we created it, so also no RTTI required). Alternatively, if there is no risk of race conditions, is there a reason not to go for |
|
ros::spinOnce() was the default before. That was changed by https://github.com/ros-planning/moveit_ros/pull/701 to support specific callbacks, with the problem of dropping nodelet support. That is the reason for not doing ros::spinOnce() in all cases. |
|
Right, but then by reverting to |
|
On Thu, Jan 26, 2017 at 10:07:50AM -0800, Maarten de Vries wrote:
Right, but then by reverting to `ros::spinOnce()` we don't support specific callback queues any more
if the callback queue is not a `ros::CallbackQueue`.
This explicitly was never the case. The requestor of the pull-request for specific callback queues was fine with that restriction.
This patch does not revert anything. It basically adds error handling to the previous request by replacing the static cast with
an RTTI-based dynamic one.
Of course it's already broken for nodelets as it is, but we should be sure not to introduce possible race conditions.
The patch fixes the recently broken non-`ros::CallbackQueue` support by reverting to the previous behavior in that case.
So this shouldn't break anything that hasn't been broken for years..
|
Nodelets weren't considered back then. Since this is specifically geared for nodelets it makes sense to look at the implications of that. However, as far as I can tell from the source, the nodelet manager doesn't even use the default callback queue. It seems to create its own thread pool and manage everything from there. That means the More importantly, since all the In other words: I think I'm convinced there's no danger of race conditions. |
Yes, you are right. Nodelets don't need ros::spinOnce() as the nodelet manager handles threads and processes message queues. Additionally, spinOnce() wouldn't help with different CallbackQueue implementations either, I think. SpinOnce() only calls the global CallbackQueue. So perhaps, I should remove the else-block? That would reduce the fix to preventing the broken cast. |
I think you're right. Maybe we should log a warning instead? Though it is possible that some other thread is already processing the relevant callback queue (like the nodelet queue), in which case the warning would be a bit of a nuisance. |
Fixed a bug with casting CallbackQueueInterface * to ros::CallbackQueue * without a check. moveit#425
|
I integrated your suggestion, added a comment (for else branch) and tried to find a helpful warning text that is emitted once instead of calling spinOnce(). |
Fixed a bug with casting CallbackQueueInterface * to ros::CallbackQueue * without a check. moveit#425
de-vri-es
left a comment
There was a problem hiding this comment.
Looks goods to me. Thanks! :)
Fixed a bug with casting CallbackQueueInterface * to ros::CallbackQueue * without a check. moveit#425
v4hn
left a comment
There was a problem hiding this comment.
I actually preferred the previous version with the explicit spinOnce, but @de-vri-es prefers that version and I'm ok with it too.
Fixed a bug with casting CallbackQueueInterface * to ros::CallbackQueue * without a check. #425
Fixed a bug with casting CallbackQueueInterface * to ros::CallbackQueue * without a check. #425
|
Merged and cherry-picked to jade/kinetic. Thank you lots for creating the issue and the patch @gaspers ! |
|
Thank you for the fast responses and for including our patch. |
* Add forward_trajectory local solver plugin (moveit#359) * Use ros2_control based joint simulation and remove unnecessary comment * Update copyrights * Restructure hybrid planning package * Fix formatting and add missing time stamp in local solver plugin * Remove unnecessary logging and param loading * Enable different interfaces between local planner and controller * Use JointGroupPositionController as demo hardware controller
Description
Fixed a bug with casting CallbackQueueInterface * to ros::CallbackQueue * without a check.
Without this additional check, creating an instance of MoveGroup in a nodelet causes a segmentation fault, because of different CallbackQueue implementations (nodelet::detail::CallbackQueue).
#425