[ 
https://issues.apache.org/jira/browse/SPARK-8895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aniket Bhatnagar updated SPARK-8895:
------------------------------------
    Description: 
StreamingContext calls env.metricsSystem.registerSource during its construction 
but does not call env.metricsSystem.removeSource. Therefore, if a user attempts 
to restart a Streaming job in the same JVM by creating a new instance of 
StreamingContext with the same application name, it results in exceptions like 
the following in the log:

??
[info] o.a.s.m.MetricsSystem -Metrics already registered
java.lang.IllegalArgumentException: A metric named 
<AppName>.StreamingMetrics.streaming.lastReceivedBatch_processingEndTime 
already exists
        at 
com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:91)~[metrics-core-3.1.0.jar:3.1.0]
        at 
com.codahale.metrics.MetricRegistry.registerAll(MetricRegistry.java:385)~[metrics-core-3.1.0.jar:3.1.0]
        at 
com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:85)~[metrics-core-3.1.0.jar:3.1.0]
        at 
org.apache.spark.metrics.MetricsSystem.registerSource(MetricsSystem.scala:148) 
~[spark-core_2.11-1.4.0.jar:1.4.0]
        at 
org.apache.spark.streaming.StreamingContext.<init>(StreamingContext.scala:199) 
[spark-streaming_2.11-1.4.0.jar:1.4.0]
        at 
org.apache.spark.streaming.StreamingContext.<init>(StreamingContext.scala:71) 
[spark-streaming_2.11-1.4.0.jar:1.4.0]
??

  was:
StreamingContext calls env.metricsSystem.registerSource during its construction 
but does not call env.metricsSystem.removeSource. Therefore, if a user attempts 
to restart a Streaming job in the same JVM by creating a new instance of 
StreamingContext with the same application name, it results in exceptions like 
the following in the log:

{{
[info] o.a.s.m.MetricsSystem -Metrics already registered
java.lang.IllegalArgumentException: A metric named 
<AppName>.StreamingMetrics.streaming.lastReceivedBatch_processingEndTime 
already exists
        at 
com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:91)~[metrics-core-3.1.0.jar:3.1.0]
        at 
com.codahale.metrics.MetricRegistry.registerAll(MetricRegistry.java:385)~[metrics-core-3.1.0.jar:3.1.0]
        at 
com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:85)~[metrics-core-3.1.0.jar:3.1.0]
        at 
org.apache.spark.metrics.MetricsSystem.registerSource(MetricsSystem.scala:148) 
~[spark-core_2.11-1.4.0.jar:1.4.0]
        at 
org.apache.spark.streaming.StreamingContext.<init>(StreamingContext.scala:199) 
[spark-streaming_2.11-1.4.0.jar:1.4.0]
        at 
org.apache.spark.streaming.StreamingContext.<init>(StreamingContext.scala:71) 
[spark-streaming_2.11-1.4.0.jar:1.4.0]
}}


> MetricsSystem.removeSource not called in StreamingContext.stop
> --------------------------------------------------------------
>
>                 Key: SPARK-8895
>                 URL: https://issues.apache.org/jira/browse/SPARK-8895
>             Project: Spark
>          Issue Type: Bug
>          Components: Streaming
>    Affects Versions: 1.4.0
>            Reporter: Aniket Bhatnagar
>            Priority: Minor
>
> StreamingContext calls env.metricsSystem.registerSource during its 
> construction but does not call env.metricsSystem.removeSource. Therefore, if 
> a user attempts to restart a Streaming job in the same JVM by creating a new 
> instance of StreamingContext with the same application name, it results in 
> exceptions like the following in the log:
> ??
> [info] o.a.s.m.MetricsSystem -Metrics already registered
> java.lang.IllegalArgumentException: A metric named 
> <AppName>.StreamingMetrics.streaming.lastReceivedBatch_processingEndTime 
> already exists
>         at 
> com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:91)~[metrics-core-3.1.0.jar:3.1.0]
>         at 
> com.codahale.metrics.MetricRegistry.registerAll(MetricRegistry.java:385)~[metrics-core-3.1.0.jar:3.1.0]
>         at 
> com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:85)~[metrics-core-3.1.0.jar:3.1.0]
>         at 
> org.apache.spark.metrics.MetricsSystem.registerSource(MetricsSystem.scala:148)
>  ~[spark-core_2.11-1.4.0.jar:1.4.0]
>         at 
> org.apache.spark.streaming.StreamingContext.<init>(StreamingContext.scala:199)
>  [spark-streaming_2.11-1.4.0.jar:1.4.0]
>         at 
> org.apache.spark.streaming.StreamingContext.<init>(StreamingContext.scala:71) 
> [spark-streaming_2.11-1.4.0.jar:1.4.0]
> ??



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to