You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by hustfxj <gi...@git.apache.org> on 2017/03/07 12:02:12 UTC

[GitHub] spark pull request #17189: [SPARK-19831][CORE] Use a separate thread to clea...

GitHub user hustfxj opened a pull request:

    https://github.com/apache/spark/pull/17189

    [SPARK-19831][CORE] Use a separate thread to clean up the finished application to avoid the block

    Cleaning the application may cost much time at worker, then it will block that the worker send heartbeats master because the worker is extend ThreadSafeRpcEndpoint. If the heartbeat from a worker is blocked by the message ApplicationFinished, master will think the worker is dead. If the worker has a driver, the driver will be scheduled by master again. 
    It had better use a separate thread to clean up the finished application to avoid the block


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/hustfxj/spark worker-hearbeat

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/17189.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #17189
    
----
commit a353262f3089c2c06fe07fc858450f771b3f54a8
Author: xiaojian.fxj <xi...@alibaba-inc.com>
Date:   2017-03-07T11:59:07Z

    [SPARK-19831][CORE] Use a separate thread to clean up the finished application to avoid the block

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by jerryshao <gi...@git.apache.org>.
Github user jerryshao commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    I think you need to call `cleanupApplicationThreadExecutor.shutdownNow()` when `worker` is stopped.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    Can one of the admins verify this patch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #17189: [SPARK-19831][CORE] Use a separate thread to clea...

Posted by hustfxj <gi...@git.apache.org>.
Github user hustfxj commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17189#discussion_r105076371
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala ---
    @@ -577,13 +582,17 @@ private[deploy] class Worker(
         val shouldCleanup = finishedApps.contains(id) && !executors.values.exists(_.appId == id)
         if (shouldCleanup) {
           finishedApps -= id
    -      appDirectories.remove(id).foreach { dirList =>
    -        logInfo(s"Cleaning up local directories for application $id")
    -        dirList.foreach { dir =>
    -          Utils.deleteRecursively(new File(dir))
    +      cleanupApplicationThreadExecutor.submit(new Runnable {
    --- End diff --
    
    I agree with you, but I am worried that cleaning up the workDir and application all cost mush time. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #17189: [SPARK-19831][CORE] Use a separate thread to clea...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17189#discussion_r105081718
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala ---
    @@ -577,13 +582,17 @@ private[deploy] class Worker(
         val shouldCleanup = finishedApps.contains(id) && !executors.values.exists(_.appId == id)
         if (shouldCleanup) {
           finishedApps -= id
    -      appDirectories.remove(id).foreach { dirList =>
    -        logInfo(s"Cleaning up local directories for application $id")
    -        dirList.foreach { dir =>
    -          Utils.deleteRecursively(new File(dir))
    +      cleanupApplicationThreadExecutor.submit(new Runnable {
    --- End diff --
    
    That won't become an issue. The worst case is there will be some pending tasks in the queue of `cleanupThreadExecutor`. Considering the number of applications is not huge, it won't be an issue.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #17189: [SPARK-19831][CORE] Reuse the existing cleanupThr...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/17189


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    **[Test build #74266 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/74266/testReport)** for PR 17189 at commit [`cbf14b2`](https://github.com/apache/spark/commit/cbf14b2a92a9fd07dcb86ed18e4ea8f88e3b01ce).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    @hustfxj Looks pretty good. Could you update the PR title and description to reflect the latest changes?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/74220/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/74266/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #17189: [SPARK-19831][CORE] Use a separate thread to clea...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17189#discussion_r104998590
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala ---
    @@ -577,13 +582,17 @@ private[deploy] class Worker(
         val shouldCleanup = finishedApps.contains(id) && !executors.values.exists(_.appId == id)
         if (shouldCleanup) {
           finishedApps -= id
    -      appDirectories.remove(id).foreach { dirList =>
    -        logInfo(s"Cleaning up local directories for application $id")
    -        dirList.foreach { dir =>
    -          Utils.deleteRecursively(new File(dir))
    +      cleanupApplicationThreadExecutor.submit(new Runnable {
    --- End diff --
    
    I prefer to just reuse the existing `cleanupThreadExecutor` like this:
    ```Scala
          appDirectories.remove(id).foreach { dirList =>
            concurrent.Future {
              logInfo(s"Cleaning up local directories for application $id")
              dirList.foreach { dir =>
                Utils.deleteRecursively(new File(dir))
              }
            }(cleanupThreadExecutor).onFailure {
              case e: Throwable =>
                logError(s"cleanup app dir $dirList failed: ${e.getMessage}", e)
            }(cleanupThreadExecutor)
          }
          shuffleService.applicationRemoved(id)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Reuse the existing cleanupThreadExec...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    LGTM. Merging to master. Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Reuse the existing cleanupThreadExec...

Posted by hustfxj <gi...@git.apache.org>.
Github user hustfxj commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    @zsxwing Of course, Thank you for your reminding


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Reuse the existing cleanupThreadExec...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    **[Test build #74397 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/74397/testReport)** for PR 17189 at commit [`8e44aab`](https://github.com/apache/spark/commit/8e44aabe3697b77353b7ffdc310c688e0cc2e0a1).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    **[Test build #74266 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/74266/testReport)** for PR 17189 at commit [`cbf14b2`](https://github.com/apache/spark/commit/cbf14b2a92a9fd07dcb86ed18e4ea8f88e3b01ce).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Reuse the existing cleanupThreadExec...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    **[Test build #74397 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/74397/testReport)** for PR 17189 at commit [`8e44aab`](https://github.com/apache/spark/commit/8e44aabe3697b77353b7ffdc310c688e0cc2e0a1).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    ok to test


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Reuse the existing cleanupThreadExec...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Reuse the existing cleanupThreadExec...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/74397/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #17189: [SPARK-19831][CORE] Use a separate thread to clea...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17189#discussion_r105236522
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala ---
    @@ -62,8 +62,8 @@ private[deploy] class Worker(
       private val forwordMessageScheduler =
         ThreadUtils.newDaemonSingleThreadScheduledExecutor("worker-forward-message-scheduler")
     
    -  // A separated thread to clean up the workDir. Used to provide the implicit parameter of `Future`
    -  // methods.
    +  // A separated thread to clean up the workDir and the finished application.
    --- End diff --
    
    nit: the directories of finished applications.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    **[Test build #74220 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/74220/testReport)** for PR 17189 at commit [`a353262`](https://github.com/apache/spark/commit/a353262f3089c2c06fe07fc858450f771b3f54a8).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17189: [SPARK-19831][CORE] Use a separate thread to clean up th...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17189
  
    **[Test build #74220 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/74220/testReport)** for PR 17189 at commit [`a353262`](https://github.com/apache/spark/commit/a353262f3089c2c06fe07fc858450f771b3f54a8).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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