Skip to content
This repository was archived by the owner on Jun 11, 2026. It is now read-only.
This repository was archived by the owner on Jun 11, 2026. It is now read-only.

AmqpPartitionReceiver.ReceivePumpAsync hangs when IPartitionReceiveHandler.ProcessErrorAsync throws #121

Description

@Rattenkrieg

There is no protection in AmqpPartitionReceiver.ReceivePumpAsync against exceptions which may be throwed from IPartitionReceiveHandle.ProcessErrorAsync
https://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 AmqpPartitionReceiver instance.
In EventProcessorHost scenario PartitionReceiveHandler : IPartitionReceiveHandler is just wrapper around IEventProcessor which first defensively tries Processor.ProcessEventsAsync then simply calls Processor.ProcessErrorAsync
If Processor.ProcessEventsAsync throws its exception propagates to AmqpPartitionReceiver.ReceivePumpAsync and goes one more time to Processor.ProcessErrorAsync.
If Processor.ProcessErrorAsync fails again on second call AmqpPartitionReceiver will end up hanged with its receivePumpTask being in Failed state.
Here is demonstration of such behavior.
I'm using IPartitionReceiveHandler since there is no way in current design to test directly on IEventProcessor, so in such test scenario only one exception from IPartitionReceiveHandler.ProcessErrorAsync is enough.

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)

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions