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

Apache Spark commented on SPARK-37147:
--------------------------------------

User 'gitplaneta' has created a pull request for this issue:
https://github.com/apache/spark/pull/34426

> MetricsReporter producing NullPointerException when element 
> 'triggerExecution' not present in Map[]
> ---------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-37147
>                 URL: https://issues.apache.org/jira/browse/SPARK-37147
>             Project: Spark
>          Issue Type: Bug
>          Components: Structured Streaming
>    Affects Versions: 3.2.0
>            Reporter: Radoslaw Busz
>            Priority: Major
>
> The exception occurs in MetricsReporter when it tries to register gauges 
> using lastProgress of each stream. This problem was partially fixed in 
> https://issues.apache.org/jira/browse/SPARK-22975 but in introduced a NPE 
> when 'triggerExecution' element is not present in durationMS map:
>  
> {code:java}
> registerGauge("latency", _.durationMs.get("triggerExecution").longValue(), 0L)
> {code}
>  
> I find it difficult to reproduce this every time but it happens every few 
> restarts when structured streaming uses a slow event source (very little or 
> no events). In my case it breaks metric reporting via Codehale/Dropwizard and 
> generates multiple stacktraces such as:
> {code:java}
> 21/09/16 09:51:36 ERROR ScheduledReporter: Exception thrown from 
> GangliaReporter#report. Exception was suppressed.
> java.lang.NullPointerException
>       at 
> org.apache.spark.sql.execution.streaming.MetricsReporter.$anonfun$new$3(MetricsReporter.scala:43)
>       at 
> org.apache.spark.sql.execution.streaming.MetricsReporter.$anonfun$new$3$adapted(MetricsReporter.scala:43)
>       at scala.Option.map(Option.scala:230)
>       at 
> org.apache.spark.sql.execution.streaming.MetricsReporter$$anon$1.getValue(MetricsReporter.scala:68)
>       at 
> com.codahale.metrics.ganglia.GangliaReporter.reportGauge(GangliaReporter.java:353)
>       at 
> com.codahale.metrics.ganglia.GangliaReporter.report(GangliaReporter.java:240)
>       at 
> com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:237)
>       at 
> com.codahale.metrics.ScheduledReporter.lambda$start$0(ScheduledReporter.java:177)
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>       at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>       at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>       at java.lang.Thread.run(Thread.java:748)
> {code}
> I'm happy to implement a fix.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to