Skip to content

[BUG] Service Bus Processor get stuck when not completing or abandoning messages with prefetch count > 0 #49018

@Vandersteen

Description

@Vandersteen

Library name and version

Azure.Messaging.ServiceBus 7.18.4

Describe the bug

When the prefetch count is set to 0 and autocompletemessage is set to false, the code below works as expected.
The processor will pick up the next message and continue processing.
The message will eventually be unlocked and tried again later.

If we set the prefetch count > 0, this does not happen. The processor gets stuck and does not pick up new messages

var serviceBusClient = new ServiceBusClient("xxx");
var processor = serviceBusClient.CreateProcessor("topic", "subscription", new ServiceBusProcessorOptions()
{
    PrefetchCount = 1,
    AutoCompleteMessages = false
});

processor.ProcessMessageAsync += async args =>
{
    var success = false;
    if (success)
    {
        await args.CompleteMessageAsync(args.Message);
    }
    else
    {
        //We want the message to be retried when the lock expires
        //So we don't complete or abandon it
        Console.WriteLine($"Not completing message {args.Message.MessageId}");
    }
};

Expected behavior

The processor does not halt

Actual behavior

The processor is stuck and does no longer consume messages

Reproduction Steps

Set the prefetch count to > 0

Environment

.NET SDK:
Version: 8.0.404
Commit: 7b190310f2
Workload version: 8.0.400-manifests.2877bc3a
MSBuild version: 17.11.9+a69bbaaf5

Runtime Environment:
OS Name: Mac OS X
OS Version: 15.0
OS Platform: Darwin
RID: osx-x64

Metadata

Metadata

Assignees

Labels

ClientThis issue is related to a non-management packageService Buscustomer-reportedIssues that are reported by GitHub users external to the Azure organization.issue-addressedWorkflow: The Azure SDK team believes it to be addressed and ready to close.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions