ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
752 stars 911 forks source link

Fix #2249: Topic statistics do not handle well ROS time jumping back #2250

Open peci1 opened 2 years ago

peci1 commented 2 years ago

First, I'm submitting a failing test.

It makes 4 repetitions of receiving 10000 messages, each time resetting ROS time from 1.0 onwards. First repetition is okay. If #2249 is not fixed, the following iterations will take considerably longer because the internal lists are never cleared.

peci1 commented 2 years ago

And the fix comes.

peci1 commented 2 years ago

Is there actually reason to copy the whole stats structure twice in each callback? Wouldn't it be better to modify it directly via an auto&? Could the reason be keeping the lists consistent even in usage by different threads? But that would mean some data would be lost if more threads were overwriting the stats structure...

peci1 commented 1 year ago

@mjcarroll @sloretz friendly ping