Crash while launching multiple instances of same nodelet
Hello, I am trying to load a nodelet multiple times. But the node is getting crashed once the second instance of the node let started executing.
Below snippet describes the way I am loading the nodelet.
std::string name = ros::this_node::getName() + "instance1";
my_argv.push_back("instance1");
my_argv.push_back("0");
my_argv.push_back("10");
manager.load(name, "myNodelet/exNodelet", remappings, my_argv);
my_argv.clear();
my_argv.push_back("instance2");
my_argv.push_back("0");
my_argv.push_back("10");
name = ros::this_node::getName() + "instance2";
manager.load(disparity_name, "myNodelet/exNodelet", remappings, my_argv);
my_argv.clear();
my_argv.push_back("instance3);
my_argv.push_back("11");
my_argv.push_back("10");
name = ros::this_node::getName() + "instance3";
manager.load(name, "myNodelet/exNodelet", remappings, my_argv);
Can anyone give any clue on why the second instance(not instance2. If I launch instance2 first then it will run perfect. The instance, launched 2nd getting crashed.) getting crashed.
Note: I am using OpenCV library in my nodelet.
Edit: I have debugged the problem further. I have noticed, when I commented OpenCV call the nodelet is launched perfectly in the second instance.
Please have a look at the gdb trace below
#0 0x00007f81913e3525 in ?? () from /opt/ros/kinetic/lib/libopencv_calib3d3.so.3.1 #1 0x00007f81913e3cd7 in ?? () from /opt/ros/kinetic/lib/libopencv_calib3d3.so.3.1 #2 0x00007f81913e679f in ?? () from /opt/ros/kinetic/lib/libopencv_calib3d3.so.3.1 #3 0x00007f81ec556cb7 in stereo_vision::stereoReconstruct::process (this=0xff9960, l_image_msg=..., l_info_msg=..., r_image_msg=..., r_info_msg=...) at /home/swahana/Murali/catkin_ws_nodelets/src/stereo_vision/src/nodelet/stereoReconstruct.cpp:271 #4 0x00007f81ec56f606 in boost::function9<void, boost::shared_ptr<sensor_msgs::image_<std::allocator<void=""> > const> const&, boost::shared_ptr<sensor_msgs::camerainfo_<std::allocator<void> > const> const&, boost::shared_ptr<sensor_msgs::image_<std::allocator<void> > const> const&, boost::shared_ptr<sensor_msgs::camerainfo_<std::allocator<void> > const> const&, boost::shared_ptr<message_filters::nulltype const=""> const&, boost::shared_ptr<message_filters::nulltype const=""> const&, boost::shared_ptr<message_filters::nulltype const=""> const&, boost::shared_ptr<message_filters::nulltype const=""> const&, boost::shared_ptr<message_filters::nulltype const=""> const&>::operator() (a8=..., a7=..., a6=..., a5=..., a4=..., a3=..., a2=..., a1=..., a0=..., this=<optimized out="">) at /usr/include/boost/function/function_template.hpp:773
Thanks in advance
Do you absolutely need to use the manager directly (ie: as a local C++ object)? Any reason you can't use the regular nodelet manager node and the service interface provided by it?
The manager used here is a regular nodelet manager. I have found from the debug information and the trails I have made by commenting OpenCV call, the issue is with the Opencv call not with the ROS.