如何从 xinetd 在 Ubuntu Precise 上启动的服务中获取核心转储

How to get a core dump from a service started by xinetd on Ubuntu Precise

我想调试因 SIGPIPE 而失败的服务。所以我为 SIGPIPE 安装了一个信号处理程序并在其中调用了 abort() 以获得核心转储。

但我一个也没有。我已经设置 sysctl -w kernel.core_pattern=/tmp/corecore 设置为 tmp 并且我设置了 /etc/security/limits.confulimit -c unlimited

那么,我怎样才能得到 core

我的 xinetd-service 文件如下所示:

service netmaumau
{
    socket_type = stream
    protocol    = tcp
    port        = 8899
    type        = UNLISTED
    flags       = KEEPALIVE
    disable     = no
    wait        = yes
    user        = heiko
    instances   = 1
    cps         = 1 10
    server      = /long/path/to/nmm-server
    server_args = -a
    log_on_success = PID HOST EXIT
    log_on_failure = HOST
}

添加

struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY }; 
setrlimit(RLIMIT_CORE, &rl);

解决了问题