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

[GitHub] spark pull request #18670: [SPARK-21455]RpcFailure should be call on RpcResp...

GitHub user ConeyLiu opened a pull request:

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

    [SPARK-21455]RpcFailure should be call on RpcResponseCallback.onFailure

    ## What changes were proposed in this pull request?
    
    Currently, when there is a `RpcFailure` need be sent back to client, we call `RpcCallContext.sendFailure`, then it will call `NettyRpcCallContext.send`. However, we can see the follow code snippets in the implementation class.
    
    ```
    private[netty] class RemoteNettyRpcCallContext(
        nettyEnv: NettyRpcEnv,
        callback: RpcResponseCallback,
        senderAddress: RpcAddress)
      extends NettyRpcCallContext(senderAddress) {
    
      override protected def send(message: Any): Unit = {
        val reply = nettyEnv.serialize(message)
        callback.onSuccess(reply)
      }
    }
    
    ```
    This is unreasonable, there are two reasons:
    Send back failure message by `RpcResponseCallback.onSuccess`, we can get the details exception messages(such as `StackTrace`) in currently implements.
    `RpcResponseCallback.onSuccess` and `RpcResponseCallback.onFailure` could have different behavior. Such as:
    NettyBlockTransferService#uploadBlock
    
    ```
    new RpcResponseCallback {
            override def onSuccess(response: ByteBuffer): Unit = {
              logTrace(s"Successfully uploaded block $blockId")
              result.success((): Unit)
            }
            override def onFailure(e: Throwable): Unit = {
              logError(s"Error while uploading block $blockId", e)
              result.failure(e)
            }
    ```
    
    
    ## How was this patch tested?
    
    Existing tests, and modified tests.
    
    Please review http://spark.apache.org/contributing.html before opening a pull request.


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

    $ git pull https://github.com/ConeyLiu/spark rpc

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

    https://github.com/apache/spark/pull/18670.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 #18670
    
----
commit 962b6059bcc9f5b54a4e01351993982ef7bab9f1
Author: Xianyang Liu <xi...@intel.com>
Date:   2017-07-18T12:42:50Z

    RpcFailure should be call on RpcResponseCallback.onFailure

----


---
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 #18670: [SPARK-21455]RpcFailure should be call on RpcResponseCal...

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

    https://github.com/apache/spark/pull/18670
  
    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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    **[Test build #79706 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79706/testReport)** for PR 18670 at commit [`962b605`](https://github.com/apache/spark/commit/962b6059bcc9f5b54a4e01351993982ef7bab9f1).
     * 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 #18670: [SPARK-21455]RpcFailure should be call on RpcResponseCal...

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

    https://github.com/apache/spark/pull/18670
  
    Hi, @cloud-fan, @zsxwing, would you mind take a look? Thanks a lot.


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    The transport library's failure callback does not do the same thing as the current code:
    
        respond(new RpcFailure(req.requestId, Throwables.getStackTraceAsString(e)));
    
    Meaning you don't get a deserialized version of the original exception, just its stack trace. So it is not the same behavior. Things like checking the original exception type or its causes will stop working if you do this.


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on R...

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

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


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    +1 to keep wire compatibility. Just for curious, if we can re-design it, shall we use `RpcFailure` to send exception?


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79706/
    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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    @ConeyLiu the network layer doesn't know how to serialize Throwable, or in other words, it cannot use JavaSerializer in Spark core.


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on R...

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

    https://github.com/apache/spark/pull/18670#discussion_r128013297
  
    --- Diff: core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala ---
    @@ -624,7 +624,9 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll {
           val e = intercept[SparkException] {
             ThreadUtils.awaitResult(f, 1 seconds)
           }
    -      assert(e.getCause.isInstanceOf[NotSerializableException])
    +      assert(e.getCause.isInstanceOf[RuntimeException])
    --- End diff --
    
    do we still need that branch? https://github.com/apache/spark/blob/master/common/network-common/src/main/java/org/apache/spark/network/client/TransportResponseHandler.java#L199


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    Ok, thanks a lot for all. close it.


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on R...

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

    https://github.com/apache/spark/pull/18670#discussion_r128132310
  
    --- Diff: core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala ---
    @@ -624,7 +624,9 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll {
           val e = intercept[SparkException] {
             ThreadUtils.awaitResult(f, 1 seconds)
           }
    -      assert(e.getCause.isInstanceOf[NotSerializableException])
    +      assert(e.getCause.isInstanceOf[RuntimeException])
    --- End diff --
    
    Because we need a `Throwable` meesage called back from server, you can see: [NettyRpcEnv.scala#L205](https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/rpc/netty/NettyRpcEnv.scala#L205)


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    > why we don't let org.apache.spark.network.protocol.RpcFailure hold one Throwable 
    
    Because that breaks wire compatibility, and you need to be able to talk to older versions of the library (e.g. an old shuffle service).


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    **[Test build #79706 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79706/testReport)** for PR 18670 at commit [`962b605`](https://github.com/apache/spark/commit/962b6059bcc9f5b54a4e01351993982ef7bab9f1).


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on R...

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

    https://github.com/apache/spark/pull/18670#discussion_r127994614
  
    --- Diff: core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala ---
    @@ -624,7 +624,9 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll {
           val e = intercept[SparkException] {
             ThreadUtils.awaitResult(f, 1 seconds)
           }
    -      assert(e.getCause.isInstanceOf[NotSerializableException])
    +      assert(e.getCause.isInstanceOf[RuntimeException])
    --- End diff --
    
    you can see here [TransportResponseHandler.java#L207](https://github.com/apache/spark/blob/master/common/network-common/src/main/java/org/apache/spark/network/client/TransportResponseHandler.java#L207)


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    Ok, thanks for the answer. I think we can use `ByteBuffer` to solve the wire compatibility problem, maybe I'm wrong. 
    I think we should change this, because we also using `onFaliure` to send failure message, as follow:
    ```scala
    respond(new RpcFailure(req.requestId, Throwables.getStackTraceAsString(e)));
    ```
    or
    ```scala
    (e) => callback.onFailure(e)
    ```
    Then the client will receive a error messages wraped in `RuntimeException`. 
    
    If all these do not need to change, I can close it.


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    As @vanzin pointed it out, this is done on purpose. RpcResponseCallback and RpcCallContext are in different modules. RpcResponseCallback is a low level api, and RpcCallContext is on top of it and interrupts a failure as a message to send via RpcResponseCallback.


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on RpcRespo...

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

    https://github.com/apache/spark/pull/18670
  
    Thanks for your reviewing. @vanzin @zsxwing I can understand what you mean. But if we really need a `Throwable` message in client, such as [NettyRpcEnv.scala#L205](https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/rpc/netty/NettyRpcEnv.scala#L205), why we don't let `org.apache.spark.network.protocol.RpcFailure` hold one `Throwable` body message instead of a `String` error message. Because we reply back error message by `RpcResponseCallback.onSuccess`, the `onSuccess` and `onFailure` can have different behavior. 


---
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 #18670: [SPARK-21455][CORE]RpcFailure should be call on R...

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

    https://github.com/apache/spark/pull/18670#discussion_r127988207
  
    --- Diff: core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala ---
    @@ -624,7 +624,9 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll {
           val e = intercept[SparkException] {
             ThreadUtils.awaitResult(f, 1 seconds)
           }
    -      assert(e.getCause.isInstanceOf[NotSerializableException])
    +      assert(e.getCause.isInstanceOf[RuntimeException])
    --- End diff --
    
    why the exception type changed?


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