Compiling with dynamic_reconfigure server code leads to deadlock
I have a package into which I want to include dynamic_reconfigure code.
EDIT: I am running Fuerte on Ubuntu 12.04
The following .cfg is compiled into PACKAGENAMEParamsConfig.h without a problem.
#! /usr/bin/env python
PACKAGE='PACKAGENAME'
import roslib; roslib.load_manifest(PACKAGE)
from dynamic_reconfigure.parameter_generator import *
gen = ParameterGenerator()
gen.add("dummy", bool_t, 0, "", True)
exit(gen.generate(PACKAGE, "Config", "PACKAGENAMEParams"))
In my source code, after including
#include <dynamic_reconfigure/server.h>
#include "PACKAGENAME/PACKAGENAMEParamsConfig.h"
(and extending the cmake file(s)) I call ros::init and setup a dynamic_reconfigure::Server object:
dynamic_reconfigure::Server<PACKAGENAME::PACKAGENAMEParamsConfig> dynamic_reconfigure_server;
When run, the program locks itself in this last line. GDB reports:
Program received signal SIGINT, Interrupt.
__lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:132
132 ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0 __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:132
#1 0x00007ffff3a87065 in _L_lock_858 () from /lib/x86_64-linux-gnu/libpthread.so.0
#2 0x00007ffff3a86eba in __pthread_mutex_lock (mutex=0xe2a7f0) at pthread_mutex_lock.c:61
#3 0x00007ffff6c8978d in ros::TransportTCP::enableRead() ()
from /opt/ros/fuerte/lib/libroscpp.so
#4 0x00007ffff6c8c0e5 in ros::TransportTCP::listen(int, int, boost::function<void (boost::shared_
ptr<ros::TransportTCP> const&)> const&) () from /opt/ros/fuerte/lib/libroscpp.so
#5 0x00007ffff6c7cd79 in ros::ConnectionManager::start() ()
from /opt/ros/fuerte/lib/libroscpp.so
#6 0x00007ffff6ca33c4 in ros::start() () from /opt/ros/fuerte/lib/libroscpp.so
#7 0x00007ffff6c79c48 in ros::NodeHandle::construct(std::string const&, bool) ()
from /opt/ros/fuerte/lib/libroscpp.so
#8 0x00007ffff6c7adc5 in ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, st
d::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > co
nst&) () from /opt/ros/fuerte/lib/libroscpp.so
#9 0x00000000005223c3 in main (argc=1, argv=0x7fffffffdff8)
at /XXXXX/PACKAGENAME/src/main.cpp:448 [<--- 448 is where the ::Server is created]
If the server constructor line is commented out, everything works. However, if my code contains a NodeHandle constructor before that, e.g.
ros::NodeHandle nh_;
dynamic_reconfigure::Server<PACKAGENAME::PACKAGENAMEParamsConfig> dynamic_reconfigure_server;
then the lock happens in the first NodeHandle constructor.
The same problem annoys me for 3 hours now... Hopefully someone can reply to this. I am using ROS Hydro btw...
Unless you can provide a way for use to reproduce we can't help much.
It was a bad idea in first place to build against Boost 1.52 with ROS-Hydro using 1.46