【问题标题】:spark Exception in task xx in stage xx (TID xx): Java heap space在阶段 xx (TID xx) 中的任务 xx 中引发异常:Java 堆空间
【发布时间】:2022-11-12 12:35:33
【问题描述】:

嗨,我在纱线上运行火花时遇到了以下问题

22/11/11 04:46:35 INFO storage.ShuffleBlockFetcherIterator: Started 119 remote fetches in 75 ms
22/11/11 04:46:35 INFO storage.ShuffleBlockFetcherIterator: Getting 530 (3.5 GiB) non-empty blocks including 0 (0.0 B) local and 0 (0.0 B) host-local and 530 (3.5 GiB) remote blocks
22/11/11 04:46:35 INFO storage.ShuffleBlockFetcherIterator: Started 4 remote fetches in 5 ms
22/11/11 04:48:32 ERROR executor.CoarseGrainedExecutorBackend: RECEIVED SIGNAL TERM
22/11/11 04:48:32 ERROR executor.Executor: Exception in task 160.1 in stage 2.0 (TID 1260): Java heap space
22/11/11 04:48:32 INFO memory.MemoryStore: MemoryStore cleared

这是我的一些火花配置:

--driver-memory 16g --executor-memory 16g --conf spark.executor.memory=6144

和发生上述错误的代码,最后一行是引发错误的地方

val sampleWindow = Window.partitionBy("productId").orderBy(org.apache.spark.sql.functions.rand())
val dfSampled = dfJoined.withColumn("row_number", row_number.over(sampleWindow)).filter(org.apache.spark.sql.functions.col("row_number") <= 10000).drop("row_number")

val convertedItemRecordDF = dfSampled.toDF.as[ItemRecord]    
convertedItemRecordDF.groupByKey(_.productId).agg(ItemLCSPerProductAggregator.toColumn.name("LCS")).write.option("header", true).option("compression", "gzip").csv(finalOutPut.toString

)

我是 spark 新手,具有上述错误任务配置的节点如下所示

已用内存=8G |总内存=66GB |使用的 VCores=2 |可用 VCores=23

【问题讨论】:

    标签: apache-spark apache-spark-sql out-of-memory shuffle


    【解决方案1】:

    似乎 groupByKey 操作导致执行器中的OOM,尝试给执行器更多的内存。 BTW,驱动根本不需要16G内存,4G就够了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-06
      • 1970-01-01
      • 1970-01-01
      • 2011-12-04
      • 1970-01-01
      相关资源
      最近更新 更多