Apache spark 获取火花执行器的错误记录-<;groupid>&书信电报;主题>;0,即使在寻求偏移后<;数量>;
我的Spark作业引发以下异常:Apache spark 获取火花执行器的错误记录-<;groupid>&书信电报;主题>;0,即使在寻求偏移后<;数量>;,apache-spark,spark-streaming,kafka-consumer-api,Apache Spark,Spark Streaming,Kafka Consumer Api,我的Spark作业引发以下异常: Exception in thread "main" org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 1 times, most recent failure: Lost task 0.0 in stage 0.0 (TID 0, localhost, executor driver): java.lang.Assertio
Exception in thread "main" org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 1 times, most recent failure: Lost task 0.0 in stage 0.0 (TID 0, localhost, executor driver): java.lang.AssertionError: assertion failed: Got wrong record for spark-executor-test-local-npp_consumer_grp_3 <topic> 0 even after seeking to offset 29599
at scala.Predef$.assert(Predef.scala:170)
这种错误的原因是什么?
发生此错误是由于卡夫卡消费端出现问题还是由于我的spark Kafka
消费程序*
查看后,我认为这应该是由于连续缓冲区未命中(我的缓冲区大小是默认大小-65536
-receive.buffer.bytes=65536
),但我在日志中没有看到缓冲区未命中消息
所以,我想知道这是否是由于缓冲区的大小
我尝试将receive.buffer.bytes
增加到655360
,但是我的spark kafka
消费者失败,出现了相同的错误。
这个错误可能是由于我的Kafka源代码由于巨大的数据而被发送造成的吗?我也有同样的问题,在spark streaming的类
CachedKafkConsumer
中发现了以下源代码。
这显然是由于消费者调查的补偿和消费者寻求的补偿不相等
我重现了这个问题,发现在卡夫卡中,从一个topicAndPartition的偏移是不连续的
def get(偏移量:长,超时:长):消费者记录[K,V]={
logDebug(s“获取$groupId$topic$partition nextofset$nextofset requested$offset”)
如果(偏移量!=nextofset){
logInfo(s“初始获取$groupId$topic$partition$offset”)
寻道(偏移)
轮询(超时)
}
如果(!buffer.hasNext()){poll(超时)}
断言(buffer.hasNext(),
s“在轮询$timeout后,无法获取$groupId$topic$partition$offset的记录”)
var record=buffer.next()
if(record.offset!=偏移量){
logInfo(s“$groupId$topic$partition$offset的缓冲区未命中”)
寻道(偏移)
轮询(超时)
断言(buffer.hasNext(),
s“在轮询$timeout后,无法获取$groupId$topic$partition$offset的记录”)
record=buffer.next()
断言(record.offset==offset,
s“即使在试图抵消$offset之后,仍获得了$groupId$topic$分区的错误记录”)
}
NEXTOFSET=偏移量+1
记录
}
当我阅读使用事务生成器填充的主题时,我也遇到了同样的问题。此问题是由事务标记(提交/中止)引起的,kafka无法读取事务标记。当您在本主题上使用--print offset选项运行SimpleConsumerShell时,应该会看到偏移之间的“间隙”
我现在看到的唯一解决方案是禁用事务生产者,因为新的spark streaming kafka尚未实现。我也遇到了这个问题,并遇到了以下链接: 此问题已在版本2.4.0中解决: 我在使用压缩主题(compressed)的消息,并使用spark-streaming-kafka-0-10_2的verion 2.3.0,它无法处理压缩 通过使用spark-streaming-kafka-0-10_2的2.4.0版,我能够解决这个问题: org.apache.spark:spark-streaming-kafka-0-10_2.11:2.4.0 我还需要配置:spark.streaming.kafka.allownonconcecutiveoffset=true 我的提交命令如下所示: spark提交--类com.streamtest.Main--主spark://myparkhost:7077 --包裹 org.apache.spark:spark-streaming-kafka-0-10_2.11:2.4.0,org.apache.spark:spark-streaming_2.11:2.3.0,org.apache.spark:spark-core_2.11:2.3.0 --conf spark.streaming.kafka.allownonconceutiveoffsets=true/work/streamapp/build/libs/streamapp.jar
((CanCommitOffsets) messages.inputDStream()).commitAsync(offsetRanges.get());`).