Fail WFT if Local Activity execution experienced an Error#1591
Fail WFT if Local Activity execution experienced an Error#1591Spikhalskiy merged 1 commit intotemporalio:masterfrom
Conversation
dd1c6e1 to
b0ddc72
Compare
b0ddc72 to
e5c7218
Compare
Sushisource
left a comment
There was a problem hiding this comment.
Makes sense to me -- this behavior should probably be added to the docstring for newLocalActivityStub / wherever else you can start LAs from Workflow
| * | ||
| * @param workflowTask task to handle | ||
| * @return an object that can be used to build workflow task completion or failure response | ||
| * @throws Throwable if processing experienced unrecoverable unexpected issues |
There was a problem hiding this comment.
Should this say "unrecoverable"? Since the idea is to let it try again with WFT failure? Unrecoverable for some smaller scope, but recoverable in the bigger sense.
There was a problem hiding this comment.
Yeah, it may be unclear with this wording. I actually mean "Unrecoverable on this worker in the context of this Workflow Task". Because you are totally correct, it doesn't mean that it's unrecoverable for the workflow, hence WFT failure. I will add a clarification.
|
@Sushisource Java devs pretty much never throw Errors, so I feel it's over-communication and just an implied correct behavior. If Error is ever thrown, the WFT is invalidated. But it may be worth mentioning in LA section of our Developer Guide for Java. |
e5c7218 to
e7ab0fb
Compare
e7ab0fb to
74440ab
Compare
|
I think I'm missing context here, why is this the intended behavior? |
|
@bergundy it's explained in the original issue and in the test comment: Users wouldn't expect a failure of a Workflow just because their worker is OutOfMemory. Currently, pre this PR, it leads to a final Local Activity failure and likely a Workflow failure. |
|
What about |
|
@bergundy IOException will be treated as it should after this change: a failure of an LA attempt or an LA failure if we are out of retries. |
|
Looks like there is an According to Stackoverflow, it usually would be thrown from Is Anyways, I'm not sure why we need this special behavior for |
|
@bergundy Yeah, I forgot about this class. IOError is thrown if the file system is broken. Or some interface is completely inaccessible and will not be accessible. For example, your app is reading from a console, but the app has no more STDIN (you will get it with Ctrl + D I believe). Anyway, an Error means that the app can't do its job anymore. If a Worker can't do its job correctly, it should not be able to fail a Workflow or an Activity execution. |
|
Might as well throw a critical failure from the worker in this case instead of failing a WFT. |
|
@bergundy Yes, this may be added, while it's tricky. Most java frameworks don't do it. The problem is that there is no reliable way to do anything after an Error, including shutting down a worker. There is also no easy standard way to notify user's code about it. |
|
I agree not waiting for WFT timeout is better here but the server also throttles WFT retries with backoff so failing local activity and reporting to the workflow ASAP is the better outcome in (what I believe is) most latency sensitive cases. |
Additionally addressing the backoff point, for low latency mode of operation we probably will have to reconsider WFT failure backoff. WFT failure in low latency mode should cause immediate scheduling if the user chooses so. |
|
Let's discuss off PR. |
What was changed
Now if a Local Activity throws an
Error, it will lead to WFT failure, not a failure of activity execution.Closes #1533