You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean Owen (Jira)" <ji...@apache.org> on 2019/08/26 14:32:00 UTC

[jira] [Resolved] (SPARK-28709) Memory leaks after stopping of StreamingContext

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

Sean Owen resolved SPARK-28709.
-------------------------------
    Fix Version/s: 3.0.0
       Resolution: Fixed

Issue resolved by pull request 25439
[https://github.com/apache/spark/pull/25439]

> Memory leaks after stopping of StreamingContext
> -----------------------------------------------
>
>                 Key: SPARK-28709
>                 URL: https://issues.apache.org/jira/browse/SPARK-28709
>             Project: Spark
>          Issue Type: Bug
>          Components: DStreams
>    Affects Versions: 2.4.3
>            Reporter: Nikita Gorbachevski
>            Assignee: Nikita Gorbachevski
>            Priority: Minor
>             Fix For: 3.0.0
>
>
> In my application spark streaming is restarted programmatically by stopping StreamingContext without stopping of SparkContext and creating/starting a new one . I use it for automatic detection of Kafka topic/partition changes and automatic failover in case of non fatal exceptions.
> However i notice that after multiple restarts driver fails with OOM. During investigation of heap dump i figured out that StreamingContext object isn't cleared by GC after stopping.
> There are several places which holds reference to it :
>  # StreamingTab registers StreamingJobProgressListener which holds reference to Streaming Context directly to LiveListenerBus shared queue via ssc.sc.addSparkListener(listener) method invocation. However this listener isn't unregistered at stop method, moreover the same listener is registered via ssc.addStreamingListener(listener) one line above so i assume this listener could just be removed or at least unregistered.
>  # json handlers (/streaming/json and /streaming/batch/json) aren't unregistered in SparkUI, while they hold reference to StreamingJobProgressListener. Basically the same issue affects all the pages, i assume that renderJsonHandler should be added to pageToHandlers cache on attachPage method invocation in order to unregistered it as well on detachPage.
>  # SparkUi holds reference to StreamingJobProgressListener in the corresponding local variable which isn't cleared after stopping of StreamingContext.
> After i applied these changes via reflection in my app OOM on driver side gone.
> I will submit a pull request to fix the mentioned issues.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

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