ros-drivers / video_stream_opencv

A package to open video streams and publish them in ROS using the opencv videocapture mechanism
229 stars 160 forks source link

fix: remove log message bomb #83

Closed moazzamak closed 3 years ago

moazzamak commented 3 years ago

Removes message bomb that happens if a frame fails to capture for whatever reason. It was generating 1.5 Gb/sec on the rosbag and equally as much in the ~/.ros/log folder.

awesomebytes commented 3 years ago

Hello, first, thanks for the contribution!

If it's just a matter of a problem of logging too fast, I'd probably go with changing the two logs to:

NODELET_ERROR_STREAM_THROTTLE(1.0, 
NODELET_WARN_STREAM_THROTTLE(1.0, 

Once a second seems reasonable to me.

If this also hogs the CPU (which I could see it happening), I do like your workaround, as the sleep only happens when the read didn't work. What do you think? Did you experience a lot of CPU usage when this happened?

moazzamak commented 3 years ago

Hi, It definitely hogs the CPU. My system can somewhat manage it since it's a pretty beefy quad core but I imagine smaller systems might be affected more. I believe this fix may solve the "memory leaks" reported in other issues as well since the messages may end up overflowing the buffers and this would impact overall memory available if you don't specify a small buffer size for rosbag recorder.

moazzamak commented 3 years ago

Is this project dead?

awesomebytes commented 3 years ago

It's not, as you may see from other issues being attended. It's just hard to sometimes find time to do proper testing.

I'll address this in xmas if no one takes over first, I'm a bit too busy these days!

On Fri, Dec 11, 2020, 03:44 Moazzam Abdullah Khan notifications@github.com wrote:

Is this project dead?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ros-drivers/video_stream_opencv/pull/83#issuecomment-742641415, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANEK5CXQOJCGET4UOQRZ23SUD3GBANCNFSM4T3PY3BQ .

moazzamak commented 3 years ago

bump

awesomebytes commented 3 years ago

Closing, as I reimplemented it with the throttling here: https://github.com/ros-drivers/video_stream_opencv/pull/96

Sorry for the lack of time! I finally finished my PhD and I have some time :)