Debug Coredump of OpenSwoole

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

If you have seen segment falt errors of your Open Swoole application, please follow the following steps to generate a call stack report.

To see the call stack related to Open Swoole, you have to add --enable-debug when compiling OpenSwoole.

1. Install gdb and enable coredump

ulimit -c unlimited

2. Run your application and generate core-dump file

Depends on your OS, the core dump file may be located at different folders: /tmp or /cores.

3. View the info in the core-dump file:

gdb php core

gdb php /tmp/core.xxxx

4. View the call stack

bt
f 1
f 0

How to enable coredump on Linux

rm -rf /tmp/core.*
ulimit -c unlimited
echo '1' > /proc/sys/kernel/core_pipe_limit
echo '1' > /proc/sys/kernel/core_uses_pid
echo '/tmp/core'> /proc/sys/kernel/core_pattern

How to enable coredump on MacOS

sudo mkdir /cores
sudo chown root:admin /cores
sudo chmod 1775 /cores
sudo chmod o+w /cores
ulimit -c unlimited
Last updated on August 31, 2022