You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposed solution is to guard this line with try-catch OR to await/ContinueWith(..., TaskContinuationOptions.OnlyOnFaulted) on receivePumpTask and shut-down receiver instance (for example by setting PartitionPumpStatus.Errored)
There is no protection in
AmqpPartitionReceiver.ReceivePumpAsyncagainst exceptions which may be throwed fromIPartitionReceiveHandle.ProcessErrorAsynchttps://github.com/Azure/azure-event-hubs-dotnet/blob/dev/src/Microsoft.Azure.EventHubs/Amqp/AmqpPartitionReceiver.cs#L303
When such occurs receivePumpTask completes in Failed state and no progress being made by
AmqpPartitionReceiverinstance.In
EventProcessorHostscenarioPartitionReceiveHandler : IPartitionReceiveHandleris just wrapper aroundIEventProcessorwhich first defensively triesProcessor.ProcessEventsAsyncthen simply callsProcessor.ProcessErrorAsyncIf
Processor.ProcessEventsAsyncthrows its exception propagates to AmqpPartitionReceiver.ReceivePumpAsync and goes one more time toProcessor.ProcessErrorAsync.If
Processor.ProcessErrorAsyncfails again on second callAmqpPartitionReceiverwill end up hanged with itsreceivePumpTaskbeing in Failed state.Here is demonstration of such behavior.
I'm using
IPartitionReceiveHandlersince there is no way in current design to test directly onIEventProcessor, so in such test scenario only one exception fromIPartitionReceiveHandler.ProcessErrorAsyncis enough.Proposed solution is to guard this line with try-catch OR to await/ContinueWith(..., TaskContinuationOptions.OnlyOnFaulted) on
receivePumpTaskand shut-down receiver instance (for example by settingPartitionPumpStatus.Errored)