ros service call kills node and throws boost::thread_interrupted [closed]
Hi
I am trying to write a simple ros service. When I call the service from the command line, it works perfectly fine.But when I call the service from my code (either from a member function or directly from main, same result), I get random node crashes (of the calling node) when the service is called. The error thrown is
terminate called after throwing an exception of 'boost::thread_interrupted'
I tried putting tests before calling the service such as
if( my_client.exists() ) {
while (!my_client.call(my_srv) ) { // wait for 1 sec }
}
But that never seems to catch anything.
Using gdb, I get
#0 0x00007ffff59accc9 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff59b00d8 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff62b7535 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff62b56d6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff62b5703 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff62b5922 in __cxa_throw () /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff6e99d38 in ros::ServiceServerLink::call(ros::SerializedMessage const&, ros::SerializedMessages&) () from /opt/ros/indigo/lib/libroscpp.so
#7 0x00007ffff6e9b02d in bool ros::ServiceClient::call(ros::SerializedMessage const&, ros::SerializedMessages&, std::string const&) () from /opt/ros/indigo/lib/libroscpp.so
#8 0x0000000000625242 in bool ros::ServiceClient::call<my_msgs::MySrvRequest_<std::allocator<void> >, my_msgs::MySrvResponse_<std::allocator<void> > >(my_msgs::MySrvRequest_<std::allocator<void> > const&, my_msgs::MySrvResponse_<std::allocator<void> >&, std::string const&) ()
#9 0x000000000061c793 in bool ros::ServiceClient::call<my_msgs::MySrv>(my_msgs::MySrv&) ()
#10 0x0000000000613795 in call_my_service(ros::ServiceClient&, Eigen::Matrix<double, 12, 1, 0, 12, 1> const&, Controller<12ul, 4ul>&) ()
Any ideas where I should look? I've been debugging this for hours... cannot find the cause.
Note that the service does not always crash, only sometimes (but quite frequently).
I also noticed this in my master log towards the point where the node crashes: (I've seen other people having the same errors without consequences, so I'm not sure if they are related.)
[rosmaster.master][INFO] 2015-07-24 09:09:05,565: -SERVICE [/my_namespace/rviz/get_loggers] /my_namespace/rviz rosrpc://my_pc
[rosmaster.threadpool][ERROR] 2015-07-24 09:09:05,565: Traceback (most recent call last):
File "/opt/ros/indigo/lib/python2.7/dist-packages/rosmaster/threadpool.py", line 218, in run
result = cmd(*args)
File "/opt/ros/indigo/lib/python2.7/dist-packages/rosmaster/master_api.py", line 208, in publisher_update_task
xmlrpcapi(api).publisherUpdate('/master', topic, pub_uris)
File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1587, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1306, in single_request
return self.parse_response(response)
File "/usr/lib/python2.7/xmlrpclib.py", line 1482, in parse_response
return u.close()
File "/usr/lib/python2.7/xmlrpclib.py", line 794, in close
raise Fault(**self._stack[0])
Fault: <Fault -1: 'publisherUpdate: unknown method name ...