Skip to content
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

[BUG] [Service Bus] Can't create session when the connection is closing #11066

Closed
Mortana89 opened this issue Apr 6, 2020 · 4 comments
Closed
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Service Bus

Comments

@Mortana89
Copy link

Mortana89 commented Apr 6, 2020

Describe the bug
We get like constant errors (100dreds per hour) in our debugger console and AI about service bus.
One of them is an InvalidOperationException:
Can't create session when the connection is closing.

This is happening when using the built-in message pump mechanism. This message pump uses the following code:

 async Task SessionPumpTaskAsync()
        {
            while (!this.pumpCancellationToken.IsCancellationRequested)
            {
                var concurrentSessionSemaphoreAcquired = false;
                try
                {
                    await this.maxConcurrentSessionsSemaphoreSlim.WaitAsync(this.pumpCancellationToken).ConfigureAwait(false);
                    concurrentSessionSemaphoreAcquired = true;

                    await this.maxPendingAcceptSessionsSemaphoreSlim.WaitAsync(this.pumpCancellationToken).ConfigureAwait(false);

// THIS LINE THROWS THE ERROR
                    var session = await this.client.AcceptMessageSessionAsync().ConfigureAwait(false);
                    if (session == null)
                    {
                        await Task.Delay(Constants.NoMessageBackoffTimeSpan, this.pumpCancellationToken).ConfigureAwait(false);
                        continue;
                    }

When breaking on that exception, I can see the client's 'IsClosedOrClosing' property is false, while the exception says otherwise:
image

However, when going deeper, in the SessionClient.AcceptMessageSessionAsync, I can see that the session is closed/closing;
image

Using .NET Core 3.1, and Microsoft.Azure.ServiceBus 4.1.2 version.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 6, 2020
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. Service Attention Workflow: This issue is responsible by Azure service team. Service Bus and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Apr 6, 2020
@ghost
Copy link

ghost commented Apr 6, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl.

@nemakam
Copy link
Contributor

nemakam commented Apr 6, 2020

Duplicate of #9416.

@nemakam
Copy link
Contributor

nemakam commented Apr 6, 2020

@Mortana89
Are you closing the queueClient/subClient when you get this exception?

@nemakam
Copy link
Contributor

nemakam commented Apr 6, 2020

I'm going to close this issue. Please respond back in the original thread to have a single place for tracking purposes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Service Bus
Projects
None yet
Development

No branches or pull requests

4 participants