Ask Your Question
3

Is there functionality built into ros to get nodes to print a stacktrace on crash?

asked 2011-05-11 16:28:02 -0600

updated 2012-02-27 13:31:11 -0600

kwc gravatar image

When ROS nodes crash, modifying launch files to run under gdb is often required to get a stack trace. And a full reattempt to produce the conditions of the crash is necessary.

75% of crash failures (made up number :) could probably be solved without running in the debugger if we could see where the crash happened on each failure.

Is there functionality built into ROS to handle this?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
8

answered 2011-05-11 16:42:30 -0600

updated 2011-05-12 05:52:24 -0600

One option (which has nothing to do with ROS internals) is to set the ulimit on core file to be non-zero and then analyze the core after the crash. (By default the core size limit is set to 0 in Ubuntu)

Set to unlimited:

ulimit -c unlimited

This will cause the OS to produce a "core file" each time there is a crash which contains some of the info needed to recreate a stack trace. The other portion of the info is contained in the executable which crashed.

The core file ends up in ~/.ros and can be analyzed with gdb like so:

gdb --core=~/.ros/core  /path/to/stack/package/bin/mynode

... where a backtrace can be obtained by using the "backtrace" or "bt" command

edit flag offensive delete link more

Comments

1

Has anyone had any luck doing this? The core file doesn't seem to turn up in ~/.ros for me...

dg-shadow gravatar imagedg-shadow ( 2017-05-23 11:22:26 -0600 )edit

Had the same problem as you, ROS kinetic on Ubuntu 16.04. Tried the /proc/sys... stuff here as well: http://wiki.ros.org/roslaunch/Tutoria...

alf gravatar imagealf ( 2017-10-04 06:38:44 -0600 )edit
1

answered 2011-05-12 04:43:30 -0600

Straszheim gravatar image

There is not. You could ticket this as an enhancement...

edit flag offensive delete link more
0

answered 2011-05-12 05:17:39 -0600

dornhege gravatar image

I think it is not necessary, when you build in debug mode. As you already said, you can just use a debugger to get the stacktrace information from the core.

Besides that, there is ROS_ASSERT, but that does only work on the crashes you somehow could predict.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2011-05-11 16:28:02 -0600

Seen: 1,240 times

Last updated: May 12 '11