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

[GitHub] spark pull request #16780: [SPARK-19438] Both reading and updating executorD...

GitHub user jinxing64 opened a pull request:

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

    [SPARK-19438] Both reading and updating executorDataMap should be guarded by CoarseGrainedSchedulerBackend.this.synchronized when handle RegisterExecutor.

    ## What changes were proposed in this pull request?
    
    Currently when handle `RegisterExecutor` in `CoarseGrainedSchedulerBackend`, `executorDataMap` is guarded by `CoarseGrainedSchedulerBackend.this.synchronized` when updating, which can cause `numPendingExecutors` incorrect. 
    Code is like below:
    ```
            if (executorDataMap.contains(executorId)) {
              executorRef.send(RegisterExecutorFailed("Duplicate executor ID: " + executorId))
              context.reply(true)
            } else {
              ...
              CoarseGrainedSchedulerBackend.this.synchronized {
                executorDataMap.put(executorId, data)
                if (currentExecutorIdCounter < executorId.toInt) {
                  currentExecutorIdCounter = executorId.toInt
                }
                if (numPendingExecutors > 0) {
                  numPendingExecutors -= 1
                  logDebug(s"Decremented number of pending executors ($numPendingExecutors left)")
                }
              }
    ```
    Consider SPARK-19437 and a scenario like below:
    An executor sent `RegisterExecutor` twice by `askWithRetry`, and the interval between the two is quite small. Thus it might be possible that both of them will go to `else` branch, thus `numPendingExecutors` will be deducted twice and become incorrect. Currently, the `askWithRetry` of `RegisterExecutor` only exists in some unit tests, but it makes sense to make it stronger when handling `RegisterExecutor`.
    
    **TO FIX**
    Use CoarseGrainedSchedulerBackend.this.synchronized to guard executorDataMap when both reading and updating.
    
    ## How was this patch tested?
    The code logic is not changed, just manually tested. SPARK-19437 can also help verify this fix.


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

    $ git pull https://github.com/jinxing64/spark SPARK-19438

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

    https://github.com/apache/spark/pull/16780.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 #16780
    
----
commit 7bb3a438eff8c8ab9567a50ca59da2e179939e76
Author: jinxing <ji...@meituan.com>
Date:   2017-02-02T15:54:08Z

    [SPARK-19438] Both reading and updating executorDataMap should be guarded by CoarseGrainedSchedulerBackend.this.synchronized when handle RegisterExecutor.

----


---
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 #16780: [SPARK-19438] Both reading and updating executorDataMap ...

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

    https://github.com/apache/spark/pull/16780
  
    > Thus it might be possible that both of them will go to else branch
    
    `receiveAnyReply` processes messages in sequence just like using one thread. This won't happen.


---
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 #16780: [SPARK-19438] Both reading and updating executorDataMap ...

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

    https://github.com/apache/spark/pull/16780
  
    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 issue #16780: [SPARK-19438] Both reading and updating executorDataMap ...

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

    https://github.com/apache/spark/pull/16780
  
    Thanks a lot for looking into this~ @zsxwing 
    You are right. My understanding about this is incorrect. `CoarseGrainedSchedulerBackend: DriverEndpoint` is a `ThreadSafeRpcEndpoint`, thus concurrent message processing is disabled.
    I'll close this PR.


---
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 #16780: [SPARK-19438] Both reading and updating executorD...

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

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


---
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