There is insufficient memory for the Java Runtime Environment to continue. 解决

在CentOS 6.4 X64环境下使用JDK 1.7 U21和Hadoop 1.2.1运行Mahout 0.9时遇到内存不足错误。通过检查系统限制、调整ulimit设置,特别是/etc/security/limits.d/90-nproc.config文件,注释掉限制用户进程数的行,从而解决了'Java Runtime Environment内存不足'的问题。

在Centos  6.4 X64, JDK 1.7 U21下用hadoop 1.2.1 运行 mahout 0.9,处理一个5GB的数据,系统提示There is insufficient memory for the Java Runtime Environment to continue.


14/07/15 08:46:05 INFO mapred.JobClient: Task Id : attempt_201407141818_0002_m_000018_0, Status : FAILED
java.lang.Throwable: Child Error
        at org.apache.hadoop.mapred.TaskRunner.run(TaskRunner.java:271)
Caused by: java.io.IOException: Task process exit with nonzero status of 1.
        at org.apache.hadoop.mapred.TaskRunner.run(TaskRunner.java:258)


attempt_201407141818_0002_m_000018_0: #
attempt_201407141818_0002_m_000018_0: # There is insufficient memory for the Java Runtime Environment to continue.
attempt_201407141818_0002_m_000018_0: # Cannot create GC thread. Out of system resources.
attempt_201407141818_0002_m_000018_0: # An error report file with more information is saved as:
attempt_201407141818_0002_m_000018_0: # /home/hadoop/hd_space/mapred/local/taskTracker/hadoop/jobcache/job_201407141818_0002/attempt_201407141818_0002_m_000018_0/work/hs_err_pid25377.log
14/07/15 08:46:07 INFO mapred.JobClient:  map 15% reduce 0%
14/07/15 08:46:09 INFO mapred.JobClient:  map 16% reduce 0%
14/07/15 08:46:09 INFO mapred.JobClient: Task Id : attempt_201407141818_0002_m_000018_1, Status : FAILED
java.lang.Throwable: Child Error
        at org.apache.hadoop.mapred.TaskRunner.run(TaskRunner.java:271)
Caused by: java.io.IOException: Task process exit with nonzero status of 1.
        at org.apache.hadoop.mapred.TaskRunner.run(TaskRunner.java:258)


attempt_201407141818_0002_m_000018_1: #
attempt_201407141818_0002_m_000018_1: # There is insufficient memory for the Java Runtime Environment to continue.
attempt_201407141818_0002_m_000018_1: # Cannot create GC thread. Out of system resources.
attempt_201407141818_0002_m_000018_1: # An error report file with more information is saved as:


查看系统限制

[root@NameNode ~]# ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 2066288
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8

文件数太少了。查看系统的/etc/security/limit.conf,etc/sysctl.conf ,换JDK版本等等,均无果!

在Root下设置 ulimit -c unlimited后,仍然不行。

[hadoop@NameNode mahout-distribution-0.9]$  ulimit -a

max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited

经过查证,再在/etc/security/下一看。centos6多出来一个limits.d目录,下面有个文件: 90-nproc.config
此文件内容:
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.


*          soft    nproc     1024
root       soft    nproc     unlimited
这里限制了1024呀,果断注释。

问题解决。




### IDEA 打包时内存不足导致 JRE 错误的解决方案 IDEA 在运行或打包项目时可能会遇到内存不足的问题,表现为错误信息 `There is insufficient memory for the Java Runtime Environment to continue`。以下是解决此问题的详细方法: #### 1. 调整 JVM 内存参数 IDEA 的运行依赖于 JVM,可以通过调整 JVM 的内存参数来提高可用内存。具体操作如下: - 打开 IDEA 安装目录下的 `bin/idea64.vmoptions` 文件(Windows 系统)或 `bin/idea.vmoptions` 文件(Mac/Linux 系统)。 - 修改以下参数以增加内存分配: ```properties -Xms3550m -Xmx4096m -XX:ReservedCodeCacheSize=2048m ``` 其中 `-Xms` 表示初始堆内存大小,`-Xmx` 表示最大堆内存大小,`-XX:ReservedCodeCacheSize` 表示保留的代码缓存大小[^2]。 #### 2. 关闭不必要的服务和进程 在微服务架构下,IDEA 可能需要同时运行多个服务(如网关、认证中心等),这会显著增加内存消耗。因此,建议关闭与当前任务无关的服务或进程[^3]。例如: - 停止未使用的子服务。 - 关闭其他占用大量内存的应用程序或后台进程。 #### 3. 检查系统内存使用情况 确保系统有足够的可用内存供 IDEA 使用。如果系统内存不足,可以尝试以下措施: - 增加物理内存(RAM)。 - 清理磁盘空间以释放虚拟内存。 - 使用任务管理器(Windows)或 `top` 命令(Linux/Mac)监控内存使用情况,并终止不必要的进程[^1]。 #### 4. 优化项目构建配置 在打包过程中,合理配置项目的构建参数可以减少内存消耗。例如: - 如果使用 Maven 构建项目,可以在 `pom.xml` 中调整插件的内存参数: ```xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <argLine>-Xmx2048m</argLine> </configuration> </plugin> </plugins> </build> ``` - 如果使用 Gradle 构建项目,可以在 `gradle.properties` 文件中设置: ```properties org.gradle.jvmargs=-Xmx2048m ``` #### 5. 查看错误日志 当 IDEA 报错时,通常会在指定路径生成一个错误日志文件(如 `\hs_err_pid33980.log`)。通过分析该日志文件,可以获取更多关于内存分配失败的详细信息,从而定位问题根源[^3]。 ```python # 示例:读取错误日志文件内容 with open(r"C:\path\to\hs_err_pid33980.log", "r") as log_file: print(log_file.read()) ``` ### 总结 通过调整 JVM 内存参数、关闭无关服务、检查系统内存使用情况以及优化项目构建配置,可以有效解决 IDEA 打包时因内存不足导致的 JRE 错误。
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值