ros-visualization / rqt_robot_plugins

9 stars 44 forks source link

rqt_robot_monitor: Apparent threading bug #78

Closed abencz closed 7 years ago

abencz commented 9 years ago

While running rqt_robot_monitor I get a continuous stream of the following in the parent terminal:

Traceback (most recent call last):
  File "/home/alex/ros_rocksteady_gui/src/rqt_robot_plugins/rqt_robot_monitor/src/rqt_robot_monitor/timeline_view.py", line 194, in _slot_redraw
    for i, m in enumerate(self._timeline):
  File "/home/alex/ros_rocksteady_gui/src/rqt_robot_plugins/rqt_robot_monitor/src/rqt_robot_monitor/timeline.p  y", line 158, in __iter__
    for msg in self._queue:
RuntimeError: deque mutated during iteration

Looks like the timeline queue is being modified by the ROS message callback in the Timeline class while at the same time being iterated over by TimelineView. I'm not what a good fix is, but I'm guessing this is causing more than just annoying error messages because I also see frequent rqt_robot_monitor freezes and crashes - most often when using the inspector window.

ablasdel commented 9 years ago

Yes it looks like the issue is that a message is coming in while screen is being redrawn. Since a message coming in triggers a redraw if the messages get pumped out fast enough this is going to happen often.

I think the solution to this is to cache all incoming messages in the callback and them process them at a regular rate. This way the redraw rate is fairly fixed. User interaction will generate redraws also so to be extra safe it would be wise to mutex the redraw and "cache process" code.

I probably won't be able to code this up until next year unfortunately.

abencz commented 9 years ago

I'm going to take a crack at fixing it.

ablasdel commented 9 years ago

Awesome! Looking forward to a PR!

ablasdel commented 9 years ago

@abencz any updates?

abencz commented 9 years ago

Didn't get a chance to look at this before Christmas vacation. Will be looking at it next week.

ablasdel commented 9 years ago

No problem was just doing a check on all issue status. Thanks for looking into it!

dirk-thomas commented 7 years ago

This issue was moved to ros-visualization/rqt_robot_monitor#1