Java 无法写入核心转储。核心转储已被禁用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28982396/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 07:07:48  来源:igfitidea点击:

Failed to write core dump. Core dumps have been disabled

javac++eclipseopencvboost

提问by Omurhan Soysal

I've been working on a vision project and using some C++ libraries in Java by JNI.

我一直在从事一个视觉项目,并在 JNI 的 Java 中使用了一些 C++ 库。

OS: Ubuntu 12.04

操作系统:Ubuntu 12.04

In my project, I'm using boostlibrary to generate random number. But sometimes I get an exception as follows:

在我的项目中,我使用boost库来生成随机数。但有时我会遇到如下异常:

Core dum140002367330048 also had an error]
#
# A fatal error has been detected by the Java Runtime Environment:    
#
#  SIGSEGV (0xb) at pc=0x00007f54f72a615a, pid=11979, tid=140002352568064
#
# JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build 1.7.0_67-b01)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libCBIR.so+0x3215a]  boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>::operator()()+0x3a
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

When I searched for this on StackOverflow, I found some issues related to the IDE (Eclipse). The application is independent of the IDE. So, the solution must be independent from the IDE, too. Any ideas?

当我在 StackOverflow 上搜索这个时,我发现了一些与 IDE (Eclipse) 相关的问题。该应用程序独立于 IDE。因此,解决方案也必须独立于 IDE。有任何想法吗?

回答by UrsinusTheStrong

I was experiencing the same issue.

我遇到了同样的问题。

As, the error itself suggests -

因为,错误本身表明 -

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try ulimit -c unlimitedbefore starting Java again

无法写入核心转储。核心转储已被禁用。要启用核心转储,请ulimit -c unlimited在再次启动 Java 之前尝试

ulimitgets and sets user limits. For more info on ulimit do -

ulimit获取和设置用户限制。有关 ulimit 的更多信息,请执行 -

man ulimit

So, open a terminal and run -

所以,打开一个终端并运行 -

ulimit -c unlimited

This should solve the problem. To check if the change was successful, run -

这应该可以解决问题。要检查更改是否成功,请运行 -

ulimit -c -l

This should give you an output as follows -

这应该给你一个输出如下 -

core file size          (blocks, -c) unlimited
max locked memory       (kbytes, -l) 64

If the problem persists refer to thisand thisfrom askUbuntu.

如果问题仍然存在指这个这个askUbuntu

回答by vishnu singh

A core dump or a crash dump is a memory snapshot of a running process. A core dump can be automatically created by the operating system when a fatal or unhandled error (for example, signal or system exception) occurs.

核心转储或崩溃转储是正在运行的进程的内存快照。当发生致命或未处理的错误(例如,信号或系统异常)时,操作系统可以自动创建核心转储。

for more info https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/bugreports004.html

更多信息https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/bugreports004.html

回答by Mike B

For anyone seeing this issue from within Jenkins (as we are): To enable core dumps from jenkins, edit /etc/init.d/jenkins and add "--core" to $DAEMON_ARGS. Setting ulimit directly from the shell script or via /etc/security/limits.conf will not work.

对于在 Jenkins 中看到此问题的任何人(就像我们一样):要从 jenkins 启用核心转储,请编辑 /etc/init.d/jenkins 并将“--core”添加到 $DAEMON_ARGS。直接从 shell 脚本或通过 /etc/security/limits.conf 设置 ulimit 将不起作用。