-
Notifications
You must be signed in to change notification settings - Fork 274
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
Fix OOP issue where context API exceptions are getting ignored #1677
base: v2.x
Are you sure you want to change the base?
Conversation
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.
This makes sense to me, I just want to make sure I understand the full ramifications of what would happen when an API exception is thrown.
// Check to see if the context API call failed e.g. because the caller tried to schedule a function that doesn't exist. | ||
if (newTask.IsFaulted) | ||
{ | ||
// Awaiting a faulted task will cause the exception to be thrown. |
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.
Just to make sure I understand the ramifications of this:
I would expect that this means that the Azure Functions execution would still have succeeded, but the orchestration will fail.
I think that is acceptable/the best we can do right now.
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.
+1, and I would love some more clarity on this difference.
More concretely: what does it mean for an Azure Functions execution to succeed while the orchestrator fails? Is this just difference in FunctionsLogs versus DurableFunctionsLogs?
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.
Yes, the function execution would succeed but the orchestration would fail. It's not ideal but it's incrementally better than where we are today. I think we'll need to revisit aspects the out-of-proc design in order to make function executions fail. I have a couple ideas on strategies we could take but I'll save that for a different forum.
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.
Oops! I was wrong! It turns out that the function execution reports as failed even though the failure happens in the out-of-proc shim layer. I added logs in the PR description to illustrate. I suspect this is the case because the exception happens in the WebJobs middleware layer which I believe is part of the core function execution.
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 for this fix, and for the refactor!
Before we merge this, do you mind sharing what error we see on the terminal when an non-existent activity is called in out-of-proc? Just so we can recognize it moving forward.
Also, a nit: I prefer the term OOProc
from OOP
as otherwise I'm not sure if we're talking about object-oriented programming or out-of-process 😉
// Check to see if the context API call failed e.g. because the caller tried to schedule a function that doesn't exist. | ||
if (newTask.IsFaulted) | ||
{ | ||
// Awaiting a faulted task will cause the exception to be thrown. |
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.
+1, and I would love some more clarity on this difference.
More concretely: what does it mean for an Azure Functions execution to succeed while the orchestrator fails? Is this just difference in FunctionsLogs versus DurableFunctionsLogs?
if (newTask != null) | ||
{ | ||
// Check to see if the context API call failed e.g. because the caller tried to schedule a function that doesn't exist. | ||
if (newTask.IsFaulted) |
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.
When else would this be set to isFaulted
be set to True
? I imagine this might also be set to True
when the activity exists but throws an exception, is that right?
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.
Indeed, I need to test a normal activity failure scenario to see whether I'm causing something weird to happen in those cases. I'll validate this more before merging.
Hmm. So in regular error handling cases I'm now seeing a null-ref exception in the orchestration replay. Not sure if it's a bug in my fix or if I'm running into a latent bug that was previously hidden.
I've put this PR into draft mode so that I can spend more time working through the various scenarios. |
@cgillum, I'm guessing this PR won't be making it into this release? |
@cgillum, any chance we could revive this PR? I'm was reminded of it after seeing this (Azure/azure-functions-durable-python#132) issue again |
Issue describing the changes in this PR
If an out-of-proc orchestration tries to call an activity that doesn't exist, the call will silently fail in the Durable extension. The result is the orchestration will hang indefinitely waiting for the activity to complete.
The issue is actually more broad than this - any exception thrown by the orchestration context object will be ignored with no tracing or other indication of a failure.
This PR fixes this issue by explicitly checking for exceptions in the out-of-proc shim and making sure the exception gets properly raised. The new result is that the orchestration in my example case will fail with a very clear error message.
Resolves Azure/azure-functions-durable-js#197
Resolves Azure/azure-functions-durable-python#132
Pull request checklist
release_notes.md