ochinchina / supervisord

a go-lang supervisor implementation
MIT License
4k stars 559 forks source link

由 supervisord 拉起来的 golang 程序无法产生 core dump 文件 #313

Open moooofly opened 2 years ago

moooofly commented 2 years ago

测试方法:

调整系统配置

ulimit -c unlimited

在 /etc/profile 中添加

export GOTRACEBACK=crash

不使用 supervisord 启动 demo 程序时,通过 kill -6 可以触发 core dump 的产生

使用 supervisord 启动 demo 程序时,通过 kill -6 无法产生 core 文件

另外,也验证过在 supervisord 的配置文件中直接设置环境变量的用法,依然没有效果

第一种配置方式

[program-default]
environment=GOTRACEBACK="crash"
command=/xxx

第二种配置方式

[program-default]
command=GOTRACEBACK=crash /xxx

请问,在使用 supervisord 管控 golang 服务的场景下,如何才能生成 core 文件?

moooofly commented 2 years ago

@ochinchina

ochinchina commented 2 years ago

Can you paste an go example program which can create coredump file when it receive signal 6?

zhangguanzhang commented 1 year ago

你起来的go程序找到pid看看有env没

xargs -0 -n1 < /proc/$pid/env* | grep TRACE
lostchai commented 3 months ago

First check the current process limit information, /proc/$pid/limits Second , check the limit of the supervisord process

The ulimit setting must be executed before supervisord is started. If you use systemd or the like for management, you need to configure it separately in the relevant configuration.