-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 - OperationCanceledException in exception received handler while closing the message receiver #6410
Comments
Thank you for opening this issue! We are routing it to the appropriate team for follow up. |
I meet a similar issue when I use the extension for Azure Functions.
|
I can (try to) help with the PR if you guys confirm this. |
Is there any existing work around for this? |
For context I running .NET Core 2.1(I tried 2.2 as well just for kicks) in an ASP.NET Core Web App and I continue to run into this error
I have run this exact same code in an .NET Core Console Application and the code works perfectly. If there is any more information I can give please let me know! |
Solved.. In the MSDN example, there is a closeAsync() that is immediately following setting up the message handler. This isn't the appropriate place when using the .NET implementation. That was the cause of my premature Cancellation. The MSDN exmaple seems to be incorrect. |
@Jtmw11, could you provide a link to the example you are referring to? I can go ahead and rectify it. |
@Jtmw11, would you please share the link to the example you are referring to? We would like to fix any documentation/example that may have problems. |
My apologies guys, after looking at it again. I used the following instructional. However I implemented it into a web app format. The issue I faced was that the console.Readline wasn't doing exactly as I had expected. Essentially each time I was opening the message handler I was closing it with the respective closeasync(). That is a misunderstanding on my end, I had forgotten it was a console based example. |
@Jtmw11, great that you identified the problem. I am going to close this issue up, but add any questions or comments and we can reopen this issue. |
Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment. |
Hi @jfggdl, I have repro. It looks like I can repro only with latest 4.0.0 ServiceBus SDK. Can you please repopen that bug?
Output:
same issue: Azure/azure-service-bus-dotnet#622 |
Have the same issue, guess will have to work with v3.4.0 until this is fixed |
Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment. |
I've ported an application from .NET Core 2.2 to 3.0 and I'm getting this exact same error. Any advice on how to proceed? |
@inkel This is not about version of .NET Core, but about version of ServiceBus Library. According to the merged PR above your comment, the fix will be in version 4.1.1 of Microsoft.Azure.ServiceBus. Current published version is 4.1.0. So you have to wait for the next release. |
Is there a way to get notified of Microsoft.Azure.ServiceBus releases specifically instead of getting notifications for everything in the azure-sdk-for-net repo? |
Thank you, @satano. |
@jsquire do you know a way to get this - #6410 (comment) |
This is something that would need to be implemented on the GitHub side. Alternatively, you can create a filter in your inbox or subscribe to a NuGet notification with a feed I've created https://libraries.io/nuget/Microsoft.Azure.ServiceBus/versions.atom. I'm using IFTTT with the feed to notify in Slack @nemakam. |
@joeyeng, FYI. The next version of |
Ha, yea I saw, thanks! 👍🏼 |
Describe the bug
I have a
QueueClient
for receiving messages (basically using it just asMessageReceiver
). It is working as expected - the messages are being processed. When I want to stop receiving messages, I callQueueClient.CloseAsync()
. There are still messages in the queue, so I will stop the receiver in the middle of the work. So the receiver/client is in the closing state, and I (almost) alway get an error in myExceptionReceivedHandler
- it isOperationCanceledException
with the simple message "The operation was canceled.".Exception or Stack Trace
I do not have a direct exception. Just the exception from
ExceptionReceivedEventArgs
. The call stack in the received exception is:To Reproduce
Just stop
MessageReceiver
while there still are messages in the queue to process and look in your exception handler.Expected behavior
I am not really sure about it. But I think that if the client is in closing state, I should not get this type of error in my error handler (
ExceptionReceivedHandler
). It is just annoying, because basically, I will get this error every time I am stopping my receiver.Setup (please complete the following information):
Additional context
I attached the source of Microsoft.Azure.ServiceBus to dig deeper what is going on.
pumpCancellationToken.IsCancellationRequested == true
. So the semaphore throwsOperationCanceledException
.catch
block, there is info about not propagatingObjectDisposedException
when the pump is stopping.OperationCanceledException
is the same and it should not be reported too.finally
block. The conditionmessage == null
istrue
, because loading of the message was skipped. And so it enters theif
and releases semaphore lock. I am not sure about this, but I think the lock was not taken (semaphore threw exception), so probably it should not be released.Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
The text was updated successfully, but these errors were encountered: