Closed xzuttz closed 2 years ago
i was surprised by this behaviour, but stream hub really is suppose to just keep chugging away. retries and an optional poison hub might make sense for certain scenarios. I've found it advances it even if it's more extension type exceptions like json deserialization error in the binding. i'd love to throw those to a poison queue and keep on chugging.
this can be closed once we merge the PR: https://github.com/Azure/azure-functions-eventhubs-extension/pull/105
Closing as fix for DryLoc exception is merged.
The current EventHubListener.cs implementation progresses the checkpoint if there is an unhandled exception in user code.
See EventHubListener.cs:
https://github.com/Azure/azure-functions-eventhubs-extension/blob/e263c0c09b360d7b8ab31c4767e58bc99a1e36ad/src/Microsoft.Azure.WebJobs.Extensions.EventHubs/Listeners/EventHubListener.cs#L155-L227
Unfortunately, internal exceptions in DryIoC are treated as user exceptions, and the user has no way of catching them.
https://github.com/Azure/azure-webjobs-sdk/issues/2432 https://github.com/Azure/azure-functions-host/issues/5240
Fixing the DryIoC exceptions is one thing. There is however no guarantee that such situations will not occur again.
I propose a slighty modified flow, where the user is able to decide whether the checkpoint should be progressed or not, if there is an unhandled user exception. This can be done through a setting in host.json.
I forked the repo and made a pull request to demonstrate. There is also a MyGet package if you want to test. Currently, in the PR, it is hardcoded to not progress the checkpoint.
PR: https://github.com/xzuttz/azure-functions-eventhubs-extension/pull/1
If you are interested in pursuing the proposal I am happy to complete the pull request with any further instructions.
Albeit I am not able to really reproduce the DryIoC exception in a test environment, we can reproduce that DryIoC exceptions, in the function scope, will be treated as user exceptions, by doing the following:
The HTTP trigger will not return.
The logs will say that the DryIoC exception came from the HTTP trigger context, thus the checkpoint will be progressed by the EventHubListener.