You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Willi Raschkowski (Jira)" <ji...@apache.org> on 2022/04/28 11:30:00 UTC

[jira] [Comment Edited] (SPARK-39044) AggregatingAccumulator with TypedImperativeAggregate throwing NullPointerException

    [ https://issues.apache.org/jira/browse/SPARK-39044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17529381#comment-17529381 ] 

Willi Raschkowski edited comment on SPARK-39044 at 4/28/22 11:29 AM:
---------------------------------------------------------------------

[~hyukjin.kwon], yes I know. But I wasn't able to get a self-contained reproducer. This reliably fails in prod. But using that same TypedImperativeAggregate with {{observe()}} in local tests works fine.

If you have ideas on what to try, I will. (Also happy to share the aggregate, but from the stacktrace I understood the implementation isn't relevant - it's the {{AggregatingAccumulator}} buffer that is {{null}}. Anyway, I attached [^aggregate.scala].)

I understand if you close this ticket because you cannot root-cause without a repro.


was (Author: raschkowski):
[~hyukjin.kwon], yes I know. But I wasn't able to get a self-contained reproducer. This reliably fails in prod. But using that same TypedImperativeAggregate with {{observe()}} in local tests works fine.

If you have ideas on what to try, I will. (Also happy to share the aggregate, but from the stacktrace I understood the implementation isn't relevant - it's the {{AggregatingAccumulator}} buffer that is {{{}null{}}}.)

I understand if you close this ticket because you cannot root-cause without a repro.

> AggregatingAccumulator with TypedImperativeAggregate throwing NullPointerException
> ----------------------------------------------------------------------------------
>
>                 Key: SPARK-39044
>                 URL: https://issues.apache.org/jira/browse/SPARK-39044
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.2.1
>            Reporter: Willi Raschkowski
>            Priority: Major
>         Attachments: aggregate.scala
>
>
> We're using a custom TypedImperativeAggregate inside an AggregatingAccumulator (via {{observe()}} and get the error below. It looks like we're trying to serialize an aggregation buffer that hasn't been initialized yet.
> {code}
> Caused by: org.apache.spark.SparkException: Job aborted.
> 	at org.apache.spark.sql.errors.QueryExecutionErrors$.jobAbortedError(QueryExecutionErrors.scala:496)
> 	at org.apache.spark.sql.execution.datasources.FileFormatWriter$.write(FileFormatWriter.scala:251)
> 	at org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelationCommand.run(InsertIntoHadoopFsRelationCommand.scala:186)
> 	at org.apache.spark.sql.execution.datasources.DataSource.writeAndRead(DataSource.scala:540)
> 	...
> Caused by: org.apache.spark.SparkException: Job aborted due to stage failure: Task 9 in stage 1.0 failed 4 times, most recent failure: Lost task 9.3 in stage 1.0 (TID 32) (10.0.134.136 executor 3): java.io.IOException: java.lang.NullPointerException
> 	at org.apache.spark.util.Utils$.tryOrIOException(Utils.scala:1435)
> 	at org.apache.spark.scheduler.DirectTaskResult.writeExternal(TaskResult.scala:51)
> 	at java.base/java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1460)
> 	at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
> 	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
> 	at java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)
> 	at org.apache.spark.serializer.JavaSerializationStream.writeObject(JavaSerializer.scala:46)
> 	at org.apache.spark.serializer.JavaSerializerInstance.serialize(JavaSerializer.scala:114)
> 	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:633)
> 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> 	at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.NullPointerException
> 	at org.apache.spark.sql.catalyst.expressions.aggregate.TypedImperativeAggregate.getBufferObject(interfaces.scala:638)
> 	at org.apache.spark.sql.catalyst.expressions.aggregate.TypedImperativeAggregate.getBufferObject(interfaces.scala:599)
> 	at org.apache.spark.sql.catalyst.expressions.aggregate.TypedImperativeAggregate.serializeAggregateBufferInPlace(interfaces.scala:621)
> 	at org.apache.spark.sql.execution.AggregatingAccumulator.withBufferSerialized(AggregatingAccumulator.scala:205)
> 	at org.apache.spark.sql.execution.AggregatingAccumulator.withBufferSerialized(AggregatingAccumulator.scala:33)
> 	at org.apache.spark.util.AccumulatorV2.writeReplace(AccumulatorV2.scala:186)
> 	at jdk.internal.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
> 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> 	at java.base/java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1235)
> 	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1137)
> 	at java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)
> 	at org.apache.spark.scheduler.DirectTaskResult.$anonfun$writeExternal$2(TaskResult.scala:55)
> 	at org.apache.spark.scheduler.DirectTaskResult.$anonfun$writeExternal$2$adapted(TaskResult.scala:55)
> 	at scala.collection.Iterator.foreach(Iterator.scala:943)
> 	at scala.collection.Iterator.foreach$(Iterator.scala:943)
> 	at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
> 	at scala.collection.IterableLike.foreach(IterableLike.scala:74)
> 	at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
> 	at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
> 	at org.apache.spark.scheduler.DirectTaskResult.$anonfun$writeExternal$1(TaskResult.scala:55)
> 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
> 	at org.apache.spark.util.Utils$.tryOrIOException(Utils.scala:1428)
> 	... 11 more
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org