Open jobafr opened 12 months ago
We're also running into this issue, especially on machines without many CPU cycles to spare.
One simple approach might be to add <param name="rosout_disable_topics_generation" value="False" />
to rosdistro/etc/ros/roscore.xml
(This was inspired by this post: https://answers.ros.org/question/301590/how-to-always-load-a-parameter-without-adding-it-to-every-launch-file/ )
I think that this will preserve the ability to set the parameter in a different launch file, but would set a default so that the caching works.
For now, we're adding that parameter to our top-level launch files.
I should add that has a huge impact on the CPU utilization of rosmaster. On our system, setting this parameter (to either true or false, it doesn't matter which) halves the rosmaster CPU utilization.
I should add that has a huge impact on the CPU utilization of rosmaster.
Yes, this is how we found this issue in the first place.
Hi,
this is a follow-up to #1855, because I think the fix there was incomplete.
When the parameter
/rosout_disable_topics_generation
is unset, the call to get_param_cached in https://github.com/ros/ros_comm/blob/noetic-devel/clients/rospy/src/rospy/impl/rosout.py#L91 returns the default value (False), but does not persist that default into the local param cache. Every subsequent call to rospy.loginfo/warn/error will then again query roscore the same way.I tested this on the current ros noetic ubuntu packages as well as on the current ros_comm noetic-devel branch. When using rospy logging a lot, this can lead to roscore consuming high amounts of CPU time and becoming unresponsive to more useful requests (which is how we noticed the problem).
Steps to reproduce:
Launch three terminal windows:
roscore
tail -f ~/.ros/log/latest/master.log
The second shell now prints this for each log call:
If you open a fourth shell, and run
rosparam set /rosout_disable_topics_generation False
, and then execure the same python code again, no '+CACHEDPARAM' calls hit the roscore anymore.I'm not sure what the correct behaviour would be here.
/rosout_disable_topics_generation
to False on startup (I'm unsure as to what that parameter actually does), which would fix the logging issue, but keep the unexpected non-caching behaviour for any other usage of get_param_cached.