Core dump debugging

Prosody and Lua itself rarely crashes so hard you need this page, but sometimes there are issues with dependencies like luaevent.

Enabling core dumps on crashes

Add this line to /etc/sysctl.conf:

kernel.core_pattern = /tmp/%t.%p.core

To enable it without rebooting, run:

sysctl -w 'kernel.core_pattern = /tmp/%t.%p.core'

In your prosody.cfg.lua add:

require"util.pposix".setrlimit("CORE", "unlimited", "unlimited")

Getting a core dump from a running Prosody

Without killing it.

prosodyctl status
# should print eg Prosody is running with PID 1234
gcore -o prosody 1234

This should produce a file prosody.1234.

Getting a backtrace

Open the core dump using gdb -c prosody.1234 /usr/bin/lua5.1, then you can get a backtrace using bt or more vebosely with bt full.

doc/coredumps.txt · Last modified: 2016/01/18 21:02 by Kim Alvefur