Troubleshooting Segfaults

On the rare occasion that you encounter a segfault please run the agent with GDB and attach a backtrace.

There are two methods for getting the backtace, you can do what works best:


If it can be reproduced interactively...

For example, cf-hub is segfaulting on report collection:

# cf-hub -q rebase -H mantisdb -v
2014-09-19T10:56:43+0300 verbose: Processing report: ELD (items: 82)
2014-09-19T10:56:43+0300 verbose: ts #0 > 1411113401
Segmentation fault

Capture the stacktrace with GDB:

# gdb /var/cfengine/bin/cf-hub
$ r -q rebase -H mantisdb -v
$ bt full

If you have a core file...
To produce a backtrace from a core-file, please use the system that generated the core file and supply the core file to the -c option to gdb.

E.g. if cf-hub produced a core-file, please run the following:

# gdb -c core-file /var/cfengine/bin/cf-hub
$ bt full

Enabling core file dumps
Intermittent issues that cannot easily be reproduced interactively are better diagnosed using a core-file. However your OS may not be producing core files by default.

On most Linux distributions you can check if core-files are enabled with

$ ulimit -c

If it says 0, they are disabled. To enable core-files you can simply do

$ ulimit -c unlimited

To set the location of the core-file, you can add this to sysctl:


However be careful with disk utilization when you do this, these core files may quickly fill up your disk!

After you have obtained your core file, you can follow the section above.


Powered by Zendesk