大网数据广告活动
服务器运维问答

Is there a mechanism in Unix (or Linux) to stop an in-progress core dump?

· 52CE 我爱测

Let's say a (very) large process is crashing and dumping core, and we know the cause from other information (possibly an assert message, maybe something else). Is there a way to stop the core dump from being completely generated,…

问题原文

原帖链接 · Mike G. · CC BY-SA 3.0

Let's say a (very) large process is crashing and dumping core, and we know the cause from other information (possibly an assert message, maybe something else).

Is there a way to stop the core dump from being completely generated, since it's a waste in this case?

For instance, would kill -9 of a core dumping process interrupt the corefile generation?

Obviously, if we knew ahead of time that we don't want core dumps, we could set the ulimit appropriately or use the OS's various core file control utilities.

But this question is about the "core dump already in progress" stage...

(For instance, imagine I'm the requestor in https://stackoverflow.com/questions/18368242/how-to-bypass-a-2tb-core-dump-file-system-limit and don't want to waste 5-6 TB of disk space :) )

已采纳解答

原帖链接 · zeridon · CC BY-SA 3.0

Generally: no, there is no way to Reliably kill a coredump.

That being said there is a possibility (at least in linux) for commercial *NIX probably no way

The possibility lies in the fact that the 3.x series of the kernel is able to interrupt file writing. One possibility is to find the thread that is doing the dumping and repeatedly send SIGKILL to it until it succeeds.

This patch series fixes the issue to some level.

Other possibility is to use the alternate syntax for the coredump_pattern. The manual says that since 2.6.19 instead of a pattern you can use a pipe and a program (with params) that will handle the dump. Ergo you will have control which dump will get written to where (/dev/null being the obvious candidate for your useless cores).

This patch also deserves a bit of attention: http://linux.derkeiler.com/Mailing-Lists/Kernel/2010-06/msg00918.html

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-01-31)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。