YARN 上的 Spark 应用程序何时退出并显示 exitCode:-104?
When does a Spark on YARN application exit with exitCode: -104?
我的 spark 应用程序读取 3 个文件,分别为 7 MB、40 MB、100MB 等等很多 t运行sformations 并存储多个目录
Spark版本CDH1.5
MASTER_URL=yarn-cluster
NUM_EXECUTORS=15
EXECUTOR_MEMORY=4G
EXECUTOR_CORES=6
DRIVER_MEMORY=3G
我的 spark 作业 运行 有一段时间了,然后抛出以下错误消息并从
开始重新启动
18/03/27 18:59:44 INFO avro.AvroRelation: using snappy for Avro output
18/03/27 18:59:47 ERROR yarn.ApplicationMaster: RECEIVED SIGNAL 15: SIGTERM
18/03/27 18:59:47 INFO CuratorFrameworkSingleton: Closing ZooKeeper client.
它再次重新启动后 运行 一段时间后失败并出现此错误
Application application_1521733534016_7233 failed 2 times due to AM Container for appattempt_1521733534016_7233_000002 exited with exitCode: -104
For more detailed output, check application tracking page:http://entline.com:8088/proxy/application_1521733534016_7233/Then, click on links to logs of each attempt.
Diagnostics: Container [pid=52716,containerID=container_e98_1521733534016_7233_02_000001] is running beyond physical memory limits. Current usage: 3.5 GB of 3.5 GB physical memory used; 4.3 GB of 7.3 GB virtual memory used. Killing container.
Dump of the process-tree for container_e98_1521733534016_7233_02_000001 :
|- PID PPID PGRPID SESSID CMD_NAME USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) RSSMEM_USAGE(PAGES) FULL_CMD_LINE
|- 52720 52716 52716 52716 (java) 89736 8182 4495249408 923677 /usr/java/jdk1.7.0_67-cloudera/bin/java -server -Xmx3072m -Djava.io.tmpdir=/apps/hadoop/data04/yarn/nm/usercache/bdbuild/appcache/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/tmp -Dspark.yarn.app.container.log.dir=/var/log/hadoop-yarn/container/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001 -XX:MaxPermSize=256m org.apache.spark.deploy.yarn.ApplicationMaster --class com.sky.ids.dovetail.asrun.etl.DovetailAsRunETLMain --jar file:/apps/projects/dovetail_asrun_etl/jars/EntLine-1.0-SNAPSHOT-jar-with-dependencies.jar --arg --app.conf.path --arg application.conf --arg --run_type --arg AUTO --arg --bus_date --arg 2018-03-27 --arg --code_base_id --arg EntLine-1.0-SNAPSHOT --executor-memory 4096m --executor-cores 6 --properties-file /apps/hadoop/data04/yarn/nm/usercache/bdbuild/appcache/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/__spark_conf__/__spark_conf__.properties
|- 52716 52714 52716 52716 (bash) 2 0 108998656 389 /bin/bash -c LD_LIBRARY_PATH=/opt/cloudera/parcels/CDH-5.5.1-1.cdh5.5.1.p0.11/lib/hadoop/../../../CDH-5.5.1-1.cdh5.5.1.p0.11/lib/hadoop/lib/native: /usr/java/jdk1.7.0_67-cloudera/bin/java -server -Xmx3072m -Djava.io.tmpdir=/apps/hadoop/data04/yarn/nm/usercache/bdbuild/appcache/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/tmp -Dspark.yarn.app.container.log.dir=/var/log/hadoop-yarn/container/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001 -XX:MaxPermSize=256m org.apache.spark.deploy.yarn.ApplicationMaster --class 'com.sky.ids.dovetail.asrun.etl.DovetailAsRunETLMain' --jar file:/apps/projects/dovetail_asrun_etl/jars/EntLine-1.0-SNAPSHOT-jar-with-dependencies.jar --arg '--app.conf.path' --arg 'application.conf' --arg '--run_type' --arg 'AUTO' --arg '--bus_date' --arg '2018-03-27' --arg '--code_base_id' --arg 'EntLine-1.0-SNAPSHOT' --executor-memory 4096m --executor-cores 6 --properties-file /apps/hadoop/data04/yarn/nm/usercache/bdbuild/appcache/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/__spark_conf__/__spark_conf__.properties 1> /var/log/hadoop-yarn/container/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/stdout 2> /var/log/hadoop-yarn/container/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/stderr
Container killed on request. Exit code is 143
Container exited with a non-zero exit code 143
Failing this attempt. Failing the application.
根据我的 CDH
Container Memory[Amount of physical memory, in MiB, that can be allocated for containers]
yarn.nodemanager.resource.memory-mb 50655 MiB
请查看我的驱动程序节点
中的容器 运行
为什么一个节点中有多个容器运行。
我知道 container_e98_1521733534016_7880_02_000001 用于我的 spark 应用程序。我不知道其他容器?对此有什么想法吗?
我还看到 container_e98_1521733534016_7880_02_000001 的物理内存是 3584,接近 3.5 GB
这个错误是什么意思?它通常发生在什么时候?
3.5 GB 的 3.5 GB 物理内存是多少?是驱动内存吗?
有人可以帮我解决这个问题吗?
container_e98_1521733534016_7233_02_000001
是第一个启动的容器,给定MASTER_URL=yarn-cluster
它不仅是ApplicationMaster,也是Spark应用的驱动
看来驱动程序的内存设置 DRIVER_MEMORY=3G
太低了,您必须提高它。
YARN 上的 Spark 默认运行两个执行器(参见 --num-executors
),因此您最终会得到 3 个 YARN 容器,其中 000001
用于 ApplicationMaster(可能带有驱动程序)和 000002
和 000003
两个执行者。
What is 3.5 GB of 3.5 GB physical memory? Is it driver memory?
由于您使用 yarn-cluster
驱动程序,因此 ApplicationMaster 和 container_e98_1521733534016_7233_02_000001
都是相同的,并且位于同一个 JVM 中。这表明错误是关于您分配给驱动程序的内存量。
我的理解是你给了 DRIVER_MEMORY=3G
这恰好对你的处理来说太少了,一旦 YARN 发现它就杀死了驱动程序(因此整个 Spark 应用程序因为它不可能有一个 Spark应用程序和 运行 没有驱动程序)。
对@Jacek 已经写的回答问题的小补充
why you get 3.5GB instead of 3GB?
是除了 DRIVER_MEMORY=3G
你需要考虑 spark.driver.memoryOverhead
可以计算为 MIN(DRIVER_MEMORY * 0.10, 384)MB = 384MB + 3GB ~ 3.5GB
我的 spark 应用程序读取 3 个文件,分别为 7 MB、40 MB、100MB 等等很多 t运行sformations 并存储多个目录
Spark版本CDH1.5
MASTER_URL=yarn-cluster
NUM_EXECUTORS=15
EXECUTOR_MEMORY=4G
EXECUTOR_CORES=6
DRIVER_MEMORY=3G
我的 spark 作业 运行 有一段时间了,然后抛出以下错误消息并从
开始重新启动18/03/27 18:59:44 INFO avro.AvroRelation: using snappy for Avro output
18/03/27 18:59:47 ERROR yarn.ApplicationMaster: RECEIVED SIGNAL 15: SIGTERM
18/03/27 18:59:47 INFO CuratorFrameworkSingleton: Closing ZooKeeper client.
它再次重新启动后 运行 一段时间后失败并出现此错误
Application application_1521733534016_7233 failed 2 times due to AM Container for appattempt_1521733534016_7233_000002 exited with exitCode: -104
For more detailed output, check application tracking page:http://entline.com:8088/proxy/application_1521733534016_7233/Then, click on links to logs of each attempt.
Diagnostics: Container [pid=52716,containerID=container_e98_1521733534016_7233_02_000001] is running beyond physical memory limits. Current usage: 3.5 GB of 3.5 GB physical memory used; 4.3 GB of 7.3 GB virtual memory used. Killing container.
Dump of the process-tree for container_e98_1521733534016_7233_02_000001 :
|- PID PPID PGRPID SESSID CMD_NAME USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) RSSMEM_USAGE(PAGES) FULL_CMD_LINE
|- 52720 52716 52716 52716 (java) 89736 8182 4495249408 923677 /usr/java/jdk1.7.0_67-cloudera/bin/java -server -Xmx3072m -Djava.io.tmpdir=/apps/hadoop/data04/yarn/nm/usercache/bdbuild/appcache/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/tmp -Dspark.yarn.app.container.log.dir=/var/log/hadoop-yarn/container/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001 -XX:MaxPermSize=256m org.apache.spark.deploy.yarn.ApplicationMaster --class com.sky.ids.dovetail.asrun.etl.DovetailAsRunETLMain --jar file:/apps/projects/dovetail_asrun_etl/jars/EntLine-1.0-SNAPSHOT-jar-with-dependencies.jar --arg --app.conf.path --arg application.conf --arg --run_type --arg AUTO --arg --bus_date --arg 2018-03-27 --arg --code_base_id --arg EntLine-1.0-SNAPSHOT --executor-memory 4096m --executor-cores 6 --properties-file /apps/hadoop/data04/yarn/nm/usercache/bdbuild/appcache/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/__spark_conf__/__spark_conf__.properties
|- 52716 52714 52716 52716 (bash) 2 0 108998656 389 /bin/bash -c LD_LIBRARY_PATH=/opt/cloudera/parcels/CDH-5.5.1-1.cdh5.5.1.p0.11/lib/hadoop/../../../CDH-5.5.1-1.cdh5.5.1.p0.11/lib/hadoop/lib/native: /usr/java/jdk1.7.0_67-cloudera/bin/java -server -Xmx3072m -Djava.io.tmpdir=/apps/hadoop/data04/yarn/nm/usercache/bdbuild/appcache/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/tmp -Dspark.yarn.app.container.log.dir=/var/log/hadoop-yarn/container/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001 -XX:MaxPermSize=256m org.apache.spark.deploy.yarn.ApplicationMaster --class 'com.sky.ids.dovetail.asrun.etl.DovetailAsRunETLMain' --jar file:/apps/projects/dovetail_asrun_etl/jars/EntLine-1.0-SNAPSHOT-jar-with-dependencies.jar --arg '--app.conf.path' --arg 'application.conf' --arg '--run_type' --arg 'AUTO' --arg '--bus_date' --arg '2018-03-27' --arg '--code_base_id' --arg 'EntLine-1.0-SNAPSHOT' --executor-memory 4096m --executor-cores 6 --properties-file /apps/hadoop/data04/yarn/nm/usercache/bdbuild/appcache/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/__spark_conf__/__spark_conf__.properties 1> /var/log/hadoop-yarn/container/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/stdout 2> /var/log/hadoop-yarn/container/application_1521733534016_7233/container_e98_1521733534016_7233_02_000001/stderr
Container killed on request. Exit code is 143
Container exited with a non-zero exit code 143
Failing this attempt. Failing the application.
根据我的 CDH
Container Memory[Amount of physical memory, in MiB, that can be allocated for containers]
yarn.nodemanager.resource.memory-mb 50655 MiB
请查看我的驱动程序节点
中的容器 运行为什么一个节点中有多个容器运行。 我知道 container_e98_1521733534016_7880_02_000001 用于我的 spark 应用程序。我不知道其他容器?对此有什么想法吗? 我还看到 container_e98_1521733534016_7880_02_000001 的物理内存是 3584,接近 3.5 GB
这个错误是什么意思?它通常发生在什么时候?
3.5 GB 的 3.5 GB 物理内存是多少?是驱动内存吗?
有人可以帮我解决这个问题吗?
container_e98_1521733534016_7233_02_000001
是第一个启动的容器,给定MASTER_URL=yarn-cluster
它不仅是ApplicationMaster,也是Spark应用的驱动
看来驱动程序的内存设置 DRIVER_MEMORY=3G
太低了,您必须提高它。
YARN 上的 Spark 默认运行两个执行器(参见 --num-executors
),因此您最终会得到 3 个 YARN 容器,其中 000001
用于 ApplicationMaster(可能带有驱动程序)和 000002
和 000003
两个执行者。
What is 3.5 GB of 3.5 GB physical memory? Is it driver memory?
由于您使用 yarn-cluster
驱动程序,因此 ApplicationMaster 和 container_e98_1521733534016_7233_02_000001
都是相同的,并且位于同一个 JVM 中。这表明错误是关于您分配给驱动程序的内存量。
我的理解是你给了 DRIVER_MEMORY=3G
这恰好对你的处理来说太少了,一旦 YARN 发现它就杀死了驱动程序(因此整个 Spark 应用程序因为它不可能有一个 Spark应用程序和 运行 没有驱动程序)。
对@Jacek 已经写的回答问题的小补充
why you get 3.5GB instead of 3GB?
是除了 DRIVER_MEMORY=3G
你需要考虑 spark.driver.memoryOverhead
可以计算为 MIN(DRIVER_MEMORY * 0.10, 384)MB = 384MB + 3GB ~ 3.5GB