ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS2 generating 'core' file on error, how to disable?

asked 2021-10-14 15:09:33 -0500

rkent gravatar image

I'm running a simple talker/listener demo, using a Docker image based on ros:galactic-ros-core w/ros-galactic-desktop installed. I'm getting an error about half the time when I run the demo, but my question is not about the error, but about the core dump. When I get the error, a large file "core" is created in the current directory which I really don't want. Is this standard behavior? Is there any supported method to stop this from happening by default, either within ROS2 or linux?

Following a cryptic comment from https://www.oreilly.com/library/view/... "... there is already a core directory to prevent core dumps" I can prevent the 'core' file from being created by creating an empty 'core' directory in the current working directory, but this is a workaround.

Not necessarily relevant, but here's the script creating the error:

# start talker and listener in background
ros2 run demo_nodes_cpp talker &
ros2 run demo_nodes_cpp listener &
sleep 10
kill %+
kill %-

and the error is "Failed to create log directory: /root/.ros/log"

edit retag flag offensive close merge delete

Comments

off-topic for your question, but

I'm running a simple talker/listener demo [..] I'm getting an error about half the time when I run the demo

is this an unaltered demo package part of the default ROS 2 set?

If it is, I would encourage you to report the crashes you're seeing, as they should not happen.

gvdhoorn gravatar image gvdhoorn  ( 2021-10-15 02:52:30 -0500 )edit

This can be duplicated, though intermittently, with the standard components from package demo_nodes_cpp and osrf:/ros:galactic-desktop. Where would I file the bug? The demo files it is based on a pretty simple, the issue is probably in roscpp.

rkent gravatar image rkent  ( 2021-10-15 18:08:33 -0500 )edit

The issue tracker for the demos packages is ros2/demos/issues.

gvdhoorn gravatar image gvdhoorn  ( 2021-10-16 11:29:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-10-15 02:36:53 -0500

gvdhoorn gravatar image

updated 2021-10-15 02:41:37 -0500

Core dumps are not specific to ROS (1 or 2), managed by it or created by any of the client libraries, but a feature of your OS. See #q260977 for a previous Q&A about them.

They're actually a very useful thing to have after a crash, as they allow a developer to debug a process post-mortem (ie: after it has already crashed and been terminated by the OS).

As to disabling their generation, you could take a look at the Arch documentation on Core dumps.

The Docker image you mention (ros:galactic-ros-core) is based on Ubuntu Focal. Canonical doesn't appear to have any documentation specifically about the configuration of core dumps (that I can find). The ulimit section in the Arch documentation should work however, as it's for Bash in general. This SO post also has some information.


Edit: I'm hesitant to duplicate information that's so easily found already, but to make this answer more self-contained:

To disable core dumps in the current Bash session: ulimit -c 0.

Or edit /etc/security/limits.conf and set soft core for * (ie: all users) to 0 (see again the Arch documentation linked earlier).

And just to reiterate: this is OS-level configuration. Not ROS.

edit flag offensive delete link more

Comments

I tried the fix in /etc/security/limits.conf earlier and it did not prevent the core file from appearing. But ulimit -c 0 seems to work when I do it in the current session. Thanks!

rkent gravatar image rkent  ( 2021-10-15 17:58:59 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-10-14 14:58:44 -0500

Seen: 425 times

Last updated: Oct 15 '21