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

need clue for "exit code 40"

asked 2011-12-19 19:26:04 -0500

clark gravatar image

updated 2011-12-19 19:27:30 -0500

When I ran a self-developed ros node via roslaunch, it could run for some time, e.g., 10 mins, and then reports the following error and quit:

"[dm-1] process has died [pid 4365, exit code 40]. log files: /home/robot/.ros/log/0119ddc6-2ad9-11e1-be05-000df06e274c/dm-1*.log"

I couldn't find any info about the exit code 40, so any help will be welcome and appreciated.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2011-12-31 14:49:14 -0500

clark gravatar image

It's weired, the same code runs without crash on another computer. What could be the reason to cause the program terminatation, which is specific to the first computer?

edit flag offensive delete link more

answered 2011-12-20 00:30:52 -0500

DimitriProsser gravatar image

updated 2011-12-28 00:58:09 -0500

Try following this tutorial to run your code in a debugger. This will give you more information regarding the error. You should also check your log files.

If your code runs for 10 minutes and then dies, my first guess would be a memory leak that's causing an overflow.

EDIT: This probably won't solve your problem, but is there any condition in your main() in which you return 050? According to gdb, that's the return code being received from the main(). Perhaps you don't have a return statement in main()?

edit flag offensive delete link more

answered 2011-12-27 20:00:48 -0500

clark gravatar image

updated 2011-12-27 20:02:54 -0500

Thanks for the hints. Here are some follow-ups.

I added launch-prefix="xterm -e gdb --args" in the launch file, and when the node finally crashes, here is the information in gdb window:


[Thread 0xb21ffb70 (LWP 5438) exited]

[Thread 0xb2be0b70 (LWP 5437) exited]

[Thread 0xb3be2b70 (LWP 5435) exited]

[Thread 0xb33e1b70 (LWP 5436) exited]

Program exited with code 050

(gdb) bt

No stack


As regards memory leakage, there is no obvious increase of memory usage throughout the running inside system monitor.

Any further advice?

edit flag offensive delete link more


Maybe it's possible to set a breakpoint at the "exit" function? Then you could print the stacktrace at that stage, before it actually exits.
raahlb gravatar image raahlb  ( 2012-01-02 21:56:23 -0500 )edit

Question Tools


Asked: 2011-12-19 19:26:04 -0500

Seen: 1,401 times

Last updated: Dec 31 '11