Yarn-为什么任务没有超出堆空间,但容器被杀死?

cl25kdpy  于 2021-06-04  发布在  Hadoop
关注(0)|答案(3)|浏览(442)

如果Yarn容器超出其堆大小设置,则map或reduce任务将失败,错误类似于以下错误:

2015-02-06 11:58:15,461 WARN org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainersMonitorImpl: Container [pid=10305,containerID=container_1423215865404_0002_01_000007] is running beyond physical memory limits. 
Current usage: 42.1 GB of 42 GB physical memory used; 42.9 GB of 168 GB virtual memory used. Killing container.
Dump of the process-tree for container_1423215865404_0002_01_000007 :
        |- PID PPID PGRPID SESSID CMD_NAME USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) RSSMEM_USAGE(PAGES) FULL_CMD_LINE
        |- 10310 10305 10305 10305 (java) 1265097 48324 46100516864 11028122 /usr/java/default/bin/java -server -XX:OnOutOfMemoryError=kill %p -Xms40960m -Xmx40960m -XX:MaxPermSize=128m -Dspark.sql.shuffle.partitions=20 -Djava.io.tmpdir=/data/yarn/datanode/nm-local-dir/usercache/admin/appcache/application_1423215865404_0002/container_1423215865404_0002_01_000007/tmp org.apache.spark.executor.CoarseGrainedExecutorBackend akka.tcp://sparkDriver@marx-61:56138/user/CoarseGrainedScheduler 6 marx-62 5
        |- 10305 28687 10305 10305 (bash) 0 0 9428992 318 /bin/bash -c /usr/java/default/bin/java -server -XX:OnOutOfMemoryError='kill %p' -Xms40960m -Xmx40960m  -XX:MaxPermSize=128m -Dspark.sql.shuffle.partitions=20 -Djava.io.tmpdir=/data/yarn/datanode/nm-local-dir/usercache/admin/appcache/application_1423215865404_0002/container_1423215865404_0002_01_000007/tmp org.apache.spark.executor.CoarseGrainedExecutorBackend akka.tcp://sparkDriver@marx-61:56138/user/CoarseGrainedScheduler 6 marx-62 5 1> /opt/hadoop/logs/userlogs/application_1423215865404_0002/container_1423215865404_0002_01_000007/stdout 2> /opt/hadoop/logs/userlogs/application_1423215865404_0002/container_1423215865404_0002_01_000007/stderr

有趣的是,所有阶段都完成了,只要调用save as sequence file,它就会失败。执行器没有用完堆空间,不知道还有什么在消耗它?

mzmfm0qo

mzmfm0qo1#

我面临与op完全相同的问题,所有阶段都成功了,只有在保存和编写结果时,容器才会被杀死。
如果超出了java堆内存,则会看到outofmemory异常,但被终止的容器与除java堆内存以外的所有内容相关,java堆内存可以与memoryoverhead或应用程序主内存相关。
就我而言 spark.yarn.executor.memoryOverhead 或者 spark.yarn.driver.memoryOverhead 没有帮助,因为可能是我的应用程序主机(am)内存不足。在 yarn-client 模式下,增加am内存的配置为 spark.yarn.am.memory . 为了 yarn-cluster 模式,它是驾驶员记忆。对我来说就是这样。
以下是我遇到的错误:

Application application_1471843888557_0604 failed 2 times due to AM Container for appattempt_1471843888557_0604_000002 exited with exitCode: -104
For more detailed output, check application tracking page:http://master01.prod2.everstring.com:8088/cluster/app/application_1471843888557_0604Then, click on links to logs of each attempt.
Diagnostics: Container [pid=89920,containerID=container_e59_1471843888557_0604_02_000001] is running beyond physical memory limits. 
Current usage: 14.0 GB of 14 GB physical memory used; 16.0 GB of 29.4 GB virtual memory used. Killing container.
dsekswqp

dsekswqp2#

在这种情况下,实际运行容器的物理内存不足:
当前使用情况:使用42 gb物理内存中的42.1 gb
虚拟内存不是限制因素。您必须增加容器的堆大小,或者增加spark.yarn.executor.memoryoverhead,以便在不必增加executor堆大小的情况下为yarn容器提供更多的空间。

ckocjqey

ckocjqey3#

spark执行器一直被杀死,spark不断重试失败的阶段。对于spark-on-yarn,如果spark-executor使用的内存大于“spark.executor.memory”+“spark.yarn.executor.memoryoverhead”的配置大小,nodemanager将终止spark-executor。增加“spark.yarn.executor.memoryoverhead”以确保它覆盖了executor堆外内存的使用。
一些问题:
https://issues.apache.org/jira/browse/spark-2398
https://issues.apache.org/jira/browse/spark-2468

相关问题