-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-6980] [CORE] Akka timeout exceptions indicate which conf controls them (RPC Layer) #6205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
97523e0
78a2c0a
5b59a44
49f9f04
23d2f26
a294569
f74064d
0ee5642
4be3a8d
b7fb99f
c07d05c
235919b
2f94095
1607a5f
4351c48
7774d56
995d196
d3754d1
08f5afc
1b9beab
2206b4d
1517721
1394de6
c6cfd33
b05d449
fa6ed82
fadaf6f
218aa50
039afed
be11c4e
7636189
3a168c7
3d8b1ff
287059a
7f4d78e
6a1c50d
4e89c75
dbd5f73
7bb70f1
06afa53
46c8d48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…edback
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,9 +20,8 @@ package org.apache.spark.rpc | |
| import java.net.URI | ||
| import java.util.concurrent.TimeoutException | ||
|
|
||
| import scala.concurrent.duration.FiniteDuration | ||
| import scala.concurrent.duration._ | ||
| import scala.concurrent.{Awaitable, Await, Future} | ||
| import scala.concurrent.duration._ | ||
| import scala.language.postfixOps | ||
|
|
||
| import org.apache.spark.{SecurityManager, SparkConf} | ||
|
|
@@ -229,7 +228,8 @@ private[spark] class RpcTimeout(timeout: FiniteDuration, description: String) { | |
| } | ||
|
|
||
| /** | ||
| * Waits for a completed result to catch and amend a TimeoutException message | ||
| * Wait for the completed result and return it. If the result is not available within this | ||
| * timeout, throw a [[RpcTimeoutException]] to indicate which configuration controls the timeout. | ||
| * @param awaitable the `Awaitable` to be awaited | ||
| * @throws RpcTimeoutException if after waiting for the specified time `awaitable` | ||
| * is still not ready | ||
|
|
@@ -242,10 +242,6 @@ private[spark] class RpcTimeout(timeout: FiniteDuration, description: String) { | |
| } | ||
|
|
||
|
|
||
| /** | ||
| * Create an RpcTimeout using a configuration property that controls the timeout duration so when | ||
| * a TimeoutException is thrown, the property key will be indicated in the message. | ||
| */ | ||
| object RpcTimeout { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
|
||
| private[this] val messagePrefix = "This timeout is controlled by " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of putting The reason I'm asking is because in the tests, where you directly construct an
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good point about the message in the tests. Way back when I first made the unit test for I don't think this is the case anymore and maybe we should use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is related to whether or not we get the time as seconds or millis. I'm thinking that we still leave the diff --git a/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala b/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala
index 5149cf1..e0de397 100644
--- a/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala
+++ b/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala
@@ -197,19 +197,16 @@ private[rpc] class RpcTimeoutException(message: String, cause: TimeoutException)
* Associates a timeout with a description so that a when a TimeoutException occurs, additional
* context about the timeout can be amended to the exception message.
* @param timeout timeout duration in seconds
- * @param description description to be displayed in a timeout exception
+ * @param conf the configuration parameter that controls this timeout
*/
-private[spark] class RpcTimeout(timeout: FiniteDuration, description: String) {
+private[spark] class RpcTimeout(timeout: FiniteDuration, val conf: String) {
/** Get the timeout duration */
def duration: FiniteDuration = timeout
- /** Get the message associated with this timeout */
- def message: String = description
-
/** Amends the standard message of TimeoutException to include the description */
private def createRpcTimeoutException(te: TimeoutException): RpcTimeoutException = {
- new RpcTimeoutException(te.getMessage() + " " + description, te)
+ new RpcTimeoutException(te.getMessage() + ". This timeout is controlled by " + conf, te)
}(and corresponding changes to the I do kinda wish that the values were read w/
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in fact we could also mark the constructor as
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see what you're saying. I kept the Quick Scala question: would it be better to make the constructor use
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -299,17 +299,17 @@ private[akka] class AkkaRpcEndpointRef( | |
|
|
||
| override def ask[T: ClassTag](message: Any, timeout: RpcTimeout): Future[T] = { | ||
| actorRef.ask(AkkaMessage(message, true))(timeout.duration).flatMap { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same thing here about catching the timeout |
||
| // The function will run in the calling thread, so it should be short and never block. | ||
| case msg @ AkkaMessage(message, reply) => | ||
| if (reply) { | ||
| logError(s"Receive $msg but the sender cannot reply") | ||
| Future.failed(new SparkException(s"Receive $msg but the sender cannot reply")) | ||
| } else { | ||
| Future.successful(message) | ||
| } | ||
| case AkkaFailure(e) => | ||
| Future.failed(e) | ||
| }(ThreadUtils.sameThread).mapTo[T]. | ||
| // The function will run in the calling thread, so it should be short and never block. | ||
| case msg @ AkkaMessage(message, reply) => | ||
| if (reply) { | ||
| logError(s"Receive $msg but the sender cannot reply") | ||
| Future.failed(new SparkException(s"Receive $msg but the sender cannot reply")) | ||
| } else { | ||
| Future.successful(message) | ||
| } | ||
| case AkkaFailure(e) => | ||
| Future.failed(e) | ||
| }(ThreadUtils.sameThread).mapTo[T]. | ||
| recover(timeout.addMessageIfTimeout)(ThreadUtils.sameThread) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you don't need to import
FiniteDurationexplicitly since you're importingduration._. Also you are supposed to order direct class imports before package imports (not just alphabetically), so it should be:the intellij import organizer will get this wrong, but aaron davidson wrote a plugin which does it right -- there are instructions for using it here: https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide#SparkCodeStyleGuide-Imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, using the plugin now