Race conditions in callbacks
I've been using ROS for a while and I just faced a possible bug. A service is called about the same time a topic got published and that topic is subscribed by the same node that implements the server.
When they run, I get a race condition, as they both use the same variable. Is it expected? I'm using python.
An example of output would be
0 1 [0.2, 0.2] 2 3 4
The list is printed inside callback for the topic and the sequence of numbers is called in the callback for the service. The service is filling the list accessed. I should be able to provide some code quite soon, as my priority is to get this working and later look for the reason (will use mutex for now).