GitHub user zsxwing opened a pull request:

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

    [SPARK-11232][Core]Use 'offer' instead of 'put' to make sure calling send 
won't be interrupted

    The current `NettyRpcEndpointRef.send` can be interrupted because it uses 
`LinkedBlockingQueue.put`, which may hang the application. 
    
    Image the following execution order:
    
      | thread 1: TaskRunner.kill | thread 2: TaskRunner.run
    ------------- | ------------- | -------------
    1 | killed = true | 
    2 |  | if (killed) {
    3 |  | throw new TaskKilledException
    4 |  | case _: TaskKilledException  _: InterruptedException if task.killed 
=>
    5 | task.kill(interruptThread): interruptThread is true |
    6 | | execBackend.statusUpdate(taskId, TaskState.KILLED, 
ser.serialize(TaskKilled)) 
    7 | | localEndpoint.send(StatusUpdate(taskId, state, serializedData)): in 
LocalBackend
    
    Then `localEndpoint.send(StatusUpdate(taskId, state, serializedData))` will 
throw `InterruptedException`. This will prevent the executor from updating the 
task status and hang the application.
    
    An failure caused by the above issue here: 
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44062/consoleFull
    
    Since `receivers` is an unbounded `LinkedBlockingQueue`, we can just use 
`LinkedBlockingQueue.offer` to resolve this issue.
    
    
    


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

    $ git pull https://github.com/zsxwing/spark dont-interrupt-send

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

    https://github.com/apache/spark/pull/9198.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 #9198
    
----
commit 8bf957e4b5772e86631deb57915449e18bed08f0
Author: zsxwing <[email protected]>
Date:   2015-10-21T16:30:18Z

    Use 'offer' instead of 'put' to make sure calling send won't be interrupted

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to