-
Notifications
You must be signed in to change notification settings - Fork 1k
Updating the description of Future exception re-throwing #434
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 all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -686,15 +686,16 @@ keeping this exception, the associated value is stored into the future or a prom | |
2. `ExecutionException` - stored when the computation fails due to an | ||
unhandled `InterruptedException`, `Error` or a | ||
`scala.util.control.ControlThrowable`. In this case the | ||
`ExecutionException` has the unhandled exception as its cause. These | ||
exceptions are rethrown in the thread executing the failed | ||
asynchronous computation. The rationale behind this is to prevent | ||
propagation of critical and control-flow related exceptions normally | ||
not handled by the client code and at the same time inform the client | ||
in which future the computation failed. | ||
|
||
See [`NonFatal`](http://www.scala-lang.org/api/current/index.html#scala.util.control.NonFatal$) | ||
for a more precise semantics description. | ||
`ExecutionException` has the unhandled exception as its cause. The rationale | ||
behind this is to prevent propagation of critical and control-flow related | ||
exceptions normally not handled by the client code and at the same time inform | ||
the client in which future the computation failed. | ||
|
||
Fatal exceptions (as determined by `NonFatal`) are rethrown in the thread executing | ||
the failed asynchronous computation. This informs the code managing the executing | ||
threads of the problem and allows it to fail fast, if necessary. See | ||
[`NonFatal`](http://www.scala-lang.org/api/current/index.html#scala.util.control.NonFatal$) | ||
for a more precise description of the semantics. | ||
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. @viktorklang Updated. Let me know if you'd like me to squash the commits down. Thanks! 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 up to @SethTisue :) 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.
@SethTisue: ping..? ;-) 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. to my knowledge, we're not picky about that in this repo. |
||
|
||
## Promises | ||
|
||
|
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.
Nice. I think it would be great to also explain the rationality for rethrowing Fatals (fail fast).
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.
@viktorklang Could you explain that in a bit more detail? Unless I'm misunderstanding something, it's not the caller that fails fast, it's the worker thread that was actually executing the body of the Future.
Do you mean that the idea is to ensure that worker processes that are "irretrievably broken" die off as soon as a non-recoverable error is detected? In that case, how about the following?
"Fatal exceptions (as determined by
NonFatal
) are rethrown in the thread executing the failed asynchronous computation.This ensures that "broken" threads in theExecutionContext
fail fast, and can be replaced if necessary. SeeNonFatal
for a more precise description of the semantics."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.
It's rethrown to the worker to escalate the problem upwards (instead of pushing the problem downstream to the consumer, which may or may not be listening or dealing with those kinds of problems).
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.
@viktorklang Thanks for clarifying. In that case, how about:
"Fatal exceptions (as determined by NonFatal) are rethrown in the thread executing the failed asynchronous computation.This informs the code managing the executing threads of the problem and allows it to fail fast, if necessary. See NonFatal for a more precise description of the semantics."
?
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.
SGTM