【问题标题】:Spark structured streaming job exited silentlySpark结构化流式作业静默退出
【发布时间】:2019-10-07 09:19:08
【问题描述】:

我有一个 Spark 结构化流式传输作业,它在应用程序日志中没有明确的错误消息而静默死亡。 它运行了大约 10 个小时,然后开始出现一些非致命错误消息。它继续产生结果大约一天,然后驱动程序容器无声无息地死了。

作业在基于 3 节点 HDP 平台的集群中运行,以纱线集群模式管理。它从 Kafka 摄取数据,进行一些计算,然后将输出发送到 Kafka 和 HDFS。

首先我查看了驱动容器的yarn应用日志,发现了这些错误信息:

19/05/19 21:02:08 ERROR AsyncEventQueue: Listener EventLoggingListener threw an exception
java.io.IOException: Failed to replace a bad datanode on the existing pipeline due to no more good datanodes being available to try. (Nodes: curr
ent=[DatanodeInfoWithStorage[10.8.0.247:50010,DS-6502520b-5b78-408b-b18d-a99df4fb76ab,DISK], DatanodeInfoWithStorage[10.8.0.145:50010,DS-d8133dc8
-cfaa-406d-845d-c819186c1450,DISK]], original=[DatanodeInfoWithStorage[10.8.0.247:50010,DS-6502520b-5b78-408b-b18d-a99df4fb76ab,DISK], DatanodeIn
foWithStorage[10.8.0.145:50010,DS-d8133dc8-cfaa-406d-845d-c819186c1450,DISK]]). The current failed datanode replacement policy is DEFAULT, and a
client may configure this via 'dfs.client.block.write.replace-datanode-on-failure.policy' in its configuration.
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.findNewDatanode(DFSOutputStream.java:1059)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.addDatanode2ExistingPipeline(DFSOutputStream.java:1122)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.setupPipelineForAppendOrRecovery(DFSOutputStream.java:1280)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.processDatanodeError(DFSOutputStream.java:1005)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:512)

End of LogType:stderr
***********************************************************************

以上是司机的最后一条消息。

看起来很糟糕,但该作业在一天内产生了 36,628 个此类错误的结果,因此它并没有导致作业直接死亡。 HDFS 系统似乎也可以正常工作。

然后我查看了执行程序日志。它们在驱动程序死亡后退出并且不包含任何错误或异常:

19/05/19 21:02:09 ERROR CoarseGrainedExecutorBackend: Executor self-exiting due to : Driver ip-10-8-0-247.us-west-2.compute.internal:11269 disass
ociated! Shutting down.

找不到原因,于是查看了yarn资源管理器的日志,发现了这些信息:

2019-05-19 18:36:44,047 INFO  availability.MetricSinkWriteShardHostnameHashingStrategy (MetricSinkWriteShardHostnameHashingStrategy.java:findColl
ectorShard(42)) - Calculated collector shard ip-10-8-0-145.us-west-2.compute.internal based on hostname: ip-10-8-0-145.us-west-2.compute.internal
2019-05-19 19:48:04,041 INFO  availability.MetricSinkWriteShardHostnameHashingStrategy (MetricSinkWriteShardHostnameHashingStrategy.java:findColl
ectorShard(42)) - Calculated collector shard ip-10-8-0-145.us-west-2.compute.internal based on hostname: ip-10-8-0-145.us-west-2.compute.internal
2019-05-19 21:02:08,797 INFO  rmcontainer.RMContainerImpl (RMContainerImpl.java:handle(422)) - container_e01_1557249464624_0669_01_000001 Contain
er Transitioned from RUNNING to COMPLETED
2019-05-19 21:02:08,797 INFO  scheduler.SchedulerNode (SchedulerNode.java:releaseContainer(220)) - Released container container_e01_1557249464624
_0669_01_000001 of capacity <memory:1024, vCores:1> on host ip-10-8-0-247.us-west-2.compute.internal:45454, which currently has 7 containers, <me
mory:19968, vCores:7> used and <memory:2560, vCores:1> available, release resources=true
2019-05-19 21:02:08,798 INFO  attempt.RMAppAttemptImpl (RMAppAttemptImpl.java:rememberTargetTransitionsAndStoreState(1209)) - Updating applicatio
n attempt appattempt_1557249464624_0669_000001 with final state: FAILED, and exit status: -104
2019-05-19 21:02:08,798 INFO  attempt.RMAppAttemptImpl (RMAppAttemptImpl.java:handle(809)) - appattempt_1557249464624_0669_000001 State change fr
om RUNNING to FINAL_SAVING
2019-05-19 21:02:08,798 INFO  integration.RMRegistryOperationsService (RMRegistryOperationsService.java:onContainerFinished(143)) - Container con
tainer_e01_1557249464624_0669_01_000001 finished, skipping purging container-level records (should be handled by AM)
2019-05-19 21:02:08,801 INFO  resourcemanager.ApplicationMasterService (ApplicationMasterService.java:unregisterAttempt(685)) - Unregistering app
 attempt : appattempt_1557249464624_0669_000001
2019-05-19 21:02:08,801 INFO  security.AMRMTokenSecretManager (AMRMTokenSecretManager.java:applicationMasterFinished(124)) - Application finished
, removing password for appattempt_1557249464624_0669_000001
2019-05-19 21:02:08,801 INFO  attempt.RMAppAttemptImpl (RMAppAttemptImpl.java:handle(809)) - appattempt_1557249464624_0669_000001 State change fr
om FINAL_SAVING to FAILED
2019-05-19 21:02:08,801 INFO  rmapp.RMAppImpl (RMAppImpl.java:transition(1331)) - The number of failed attempts is 1. The max attempts is 2
2019-05-19 21:02:08,801 INFO  rmapp.RMAppImpl (RMAppImpl.java:handle(779)) - application_1557249464624_0669 State change from RUNNING to ACCEPTED
2019-05-19 21:02:08,801 INFO  capacity.CapacityScheduler (CapacityScheduler.java:doneApplicationAttempt(812)) - Application Attempt appattempt_15
57249464624_0669_000001 is done. finalState=FAILED

看起来纱线也没有杀死这项工作。驱动程序容器突然从 RUNNING 变为 COMPLETED。

我希望看到一些明确的消息,例如 OOM 导致作业崩溃,但现在我对它为什么静默退出感到困惑。与HDFS错误有什么关系吗?当异常太多时(即使它们不是致命的),Spark 中是否有任何机制可以静默停止驱动程序?欢迎任何建议,谢谢!

【问题讨论】:

    标签: apache-spark hdfs hadoop-yarn hortonworks-data-platform spark-structured-streaming


    【解决方案1】:

    纱线退出代码 -104 表示physical memory limits for that Yarn container were exceeded

    容器因超出分配的物理内存限制而终止。

    当您在 AWS 上运行时,您可以为驱动程序节点使用更高 RAM 的实例类型。

    【讨论】:

    • 谢谢利亚姆,是的,我认为这是因为纱线在超过内存限制后杀死了容器,你知道为什么会这样吗?我的意思是,我之前看到的内存问题通常是在应用程序日志中打印一条错误消息,Spark 抱怨没有足够的内存,所以我知道内存不够并且会增加内存。但是从火花的角度来看,这里似乎有足够的记忆,而从纱线的角度来看,没有。这令人困惑。
    【解决方案2】:

    详情请查看以下链接-

    Ref: Bad DataNode Failure Issue Hortonworks-

    原因:- 当我们在小型集群(少于 5 个数据节点的集群)上运行作业并且数据负载很重时,会出现此问题。如果写入管道中存在数据节点/网络故障,DFSClient 将尝试从管道中删除失败的数据节点,然后继续使用剩余的数据节点进行写入。结果,管道中的数据节点数量减少了。下面解释的属性可以帮助我们解决这个问题。

    解决方案:- 请更改DataNode更换策略如下-

    要解决此问题,请从 Ambari > HDFS > 配置 > 自定义 HDFS 站点 > 添加属性设置以下两个属性:

    dfs.client.block.write.replace-datanode-on-failure.enable=NEVER
    dfs.client.block.write.replace-datanode-on-failure.policy=NEVER
    

    【讨论】:

    • 感谢 MIKHIL,这是 HDP 2.6.1、2.5.5、2.6、2.6.3、2.6.4 的问题,但我正在运行 HDP 2.6.5,但找不到配置参数。我认为它确实解释了 HDFS 错误,我会尝试调整 HDFS 设置,但我的主要问题仍然是驱动程序退出问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-04
    • 1970-01-01
    • 1970-01-01
    • 2018-05-27
    • 1970-01-01
    相关资源
    最近更新 更多