无法写入核心转储文件。已禁用核心转储。

29

我一直在进行一个视觉项目,并使用JNI在Java中使用一些C++库。

操作系统:Ubuntu 12.04

在我的项目中,我正在使用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

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


你尝试过像错误信息建议的那样使用 ulimit -c unlimited 吗? - Mike Seymour
尝试在Ubuntu中启用核心转储 - http://ubuntuforums.org/showthread.php?t=1494590 - SChepurin
我尝试了这样的方法,然后再次运行应用程序:su - ; ulimit -c unlimited; ulimit -a;我会再次写下来。 - Omurhan Soysal
1
@OmurhanSoysal,您能否写出完整的答案?我无法完成它。 - Kenenbek Arzymatov
4个回答

34

我遇到了同样的问题。

正如错误本身所示 -

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

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

man ulimit

那么,打开终端并运行 -

ulimit -c unlimited
这应该可以解决问题。为了检查更改是否成功,请运行 -
ulimit -c -l

这应该会给您一个如下的输出 -

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

如果问题仍然存在,请参考这个这个来自askUbuntu的内容。


看起来很明显,但这个答案对我有帮助,因为我不确定建议的命令(ulimit -c unlimited)会引起什么问题。我的问题已经解决了。谢谢。 - Pedro Alvares

2

1

如果在Jenkins中遇到此问题(我们也是),要启用来自Jenkins的核心转储,请编辑/etc/init.d/jenkins并将"--core"添加到$DAEMON_ARGS。直接从shell脚本或通过/etc/security/limits.conf设置ulimit将不起作用。


1

在我的情况下,这个错误是因为我在项目中使用了错误的Java版本。我应该使用Java 11,但我使用了Java 8。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接