如何转储 runc 的堆栈跟踪

How to dump the stack trace of runc

我正在调试 runc 卡住的容器问题。我想知道如何转储 runc 的堆栈跟踪以了解它卡在哪里。似乎有可能基于此响应:https://github.com/opencontainers/runc/pull/2871#issuecomment-816492231 on another runc stuck issue.

我想出了一个办法。 运行 cat /proc/<runc_pid>/fd/2 打印出故障 runc 进程填满时的 stderr 消息。使用 kill -SIGQUIT <runc_pid> 向进程发送 SIGQUIT 终止信号,这将导致 go 例程堆栈跟踪转储到 stderr 上,可以使用之前启动的 cat 查看。