roscore using up all available memory
Hello,
I am running ros noetic inside a docker container. For that I use the following image:
ros:noetic-ros-base-focal
I sat the memory limit of the container to 8gb. When I run roscore without any other node running, it uses all memory, hits the 8gb limit and restart the process with the following error:
started core service [/rosout]
[rosout-1] process has died [pid 33303, exit code -9, cmd /opt/ros/noetic/lib/rosout/rosout __name:=rosout __log:=/root/.ros/log/3332fba4-07df-11ee-aa40-a87eea88c6dd/rosout-1.log].
log file: /root/.ros/log/3332fba4-07df-11ee-aa40-a87eea88c6dd/rosout-1*.log
[rosout-1] restarting process
The log file mentioned in the error is empty, but this is the contents of the master.log file:
[rosmaster.main][INFO] 2023-06-11 00:36:11,859: initialization complete, waiting for shutdown
[rosmaster.main][INFO] 2023-06-11 00:36:11,860: Starting ROS Master Node
[xmlrpc][INFO] 2023-06-11 00:36:11,861: XML-RPC server binding to 0.0.0.0:11311
[xmlrpc][INFO] 2023-06-11 00:36:11,861: Started XML-RPC server [http://fedora:11311/]
[xmlrpc][INFO] 2023-06-11 00:36:11,861: xml rpc node: starting XML-RPC server
[rosmaster.master][INFO] 2023-06-11 00:36:11,861: Master initialized: port[11311], uri[http://fedora:11311/]
[rosmaster.master][INFO] 2023-06-11 00:36:11,898: +PARAM [/run_id] by /roslaunch
[rosmaster.master][INFO] 2023-06-11 00:36:11,899: +PARAM [/roslaunch/uris/host_fedora__39467] by /roslaunch
[rosmaster.master][INFO] 2023-06-11 00:36:11,964: +PARAM [/rosversion] by /roslaunch
[rosmaster.master][INFO] 2023-06-11 00:36:11,964: +PARAM [/rosdistro] by /roslaunch
[rosmaster.main][INFO] 2023-06-11 00:36:19,873: keyboard interrupt, will exit
[rosmaster.main][INFO] 2023-06-11 00:36:19,874: stopping master...
[rospy.core][INFO] 2023-06-11 00:36:19,874: signal_shutdown [atexit]
I already tried this (https://answers.ros.org/question/3369...) but it did not fix the error.
Thank you in advance and let me know if you need any more information.
Please edit your post to include the command you use to start docker container. It seems very likely that the link you included correctly identifies the cause of the high memory use.
Thank you very much for your comment. It made me look at the post again and you are correct. Looking through the answers I noticed the
ulimit -Sn 524288
again. It turns out I need to set the soft limit first and then the hard limit:ulimit -Sn 524288 && ulimit -Hn 524288
. I did it this way because I wanted to fix this issue on an existing container.