-
Notifications
You must be signed in to change notification settings - Fork 2k
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] Accepting more than 256 sessions on single instance of ServiceBusSessionReceiverAsyncClient breaks connectivity but does not throw an error #32211
Comments
@liukun-msft could you please take a look? |
@marxxxx Thank you for contacting us! I'll check it and get back to you soon. |
I can succesfully repro the issue and see lots of I may take more time to find the root cause. I'll keep you updates for any progress. |
Hi @marxxxx By digging into the logs, I found that the reason is that the service side has session number limitation. When a client accepts more than 255 sessions, it will receive an
.NET should also be limited to 255 sessions, can you provide the corresponding .NET code snippet? I can double check that.
Due to the limitation of the service side, if you want to receive more sessions, you need to create a new client, like below code: ArrayList<ServiceBusSessionReceiverAsyncClient> receivers = new ArrayList<>();
ServiceBusSessionReceiverAsyncClient sessionReceiver = null;
for (int i = 0; i < SessionCount; i++) {
if (i % 255 == 0) {
sessionReceiver = new ServiceBusClientBuilder()
.connectionString(Credentials.serviceBusConnectionString)
.sessionReceiver()
.receiveMode(ServiceBusReceiveMode.PEEK_LOCK)
.queueName(sessionQueue)
.buildAsyncClient();
receivers.add(sessionReceiver);
}
String sessionId = String.valueOf(i);
System.out.println("Receiving from Session " + sessionId);
Disposable sub = sample.run(sessionReceiver, sessionId);
subscriptions.add(sub);
} I am not sure if you are using the same You can tell us more about why this work around is not helpful for your scenarios. Enhancement For SDK team, since the our logs contains a lot of close procedures that hide the real errors, we will going to tune the log afterwards, which is tracked by this issue: #20836. We will also review the error handling logic when this particular error occurs. |
Sorry for the delay. I just verified that the current .NET Core SDK does not show this behavior. You can use this sample code to replicate it:
|
We can currently live with this workaround but i'm a bit doubtful about the behavior, the SDK shows. When we don't receive any exceptions in our code when this limit is hit and all the existing subscriptions just stop working from this point, the root causes are very hard to track and put us at risk for service disruptions. Also when we hard-code this limit in our application and you decide to change it at a later stage, chances are high that this adjustment will not be done in our application and either we face errors hard to track (if you decide to lower the limit) or make sub-optimal use of resources (if you raise the limit and a connection could hold more than 255 connections but we still have this limitation applied). |
Thanks! I will compare the differences with the .NET code and see if we can increase the limit. |
Hi @marxxxx, The behavior is different because the implementation of acceptSession() is different in Java and .NET In Java SDK, it uses a shared AQMP session to communicate with the same entity (i.e. queue or topic). When we call In NET SDK, when we call When we call |
Hi @marxxxx, we deeply appreciate your input into this project. Regrettably, this issue has remained unresolved for over 2 years and inactive for 30 days, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support. |
Describe the bug
When using a single instance of ServiceBusSessionReceiverAsyncClient and calling acceptSession for >= 257 sessions, all previously registered sessions with the same ServiceBusSessionReceiverAsyncClient will stop receiving any messages from any of the sessions.
We are able to work around the issue by using multiple instances of ServiceBusSessionReceiverAsyncClient but the behavior of the SDK is not very helpful.
In comparison, the .NET SDK's limit of what a single Instance of ServiceBusClient can handle is much higher (5000 Subscriptions) and it throws an exception when the limit is exceeded.
Exception or Stack Trace
No exception is thrown, it's possible to call acceptSession even for > 10000 sessions without any error.
To Reproduce
See below Code-Snipped. It is based on https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus/ReceiveNamedSessionAsyncSample.java
Provide your connection string and the Name of your Queue in the respective constants.
The queue must have sessions enabled.
None of the subscriptions will receive any messages from any of the sessions.
Changing SessionCount to 256 establishes connectivity for all of the sessions.
Code Snippet
Expected behavior
When there is a limit of 256 subscriptions i would expect an exception to be thrown.
The .NET SDK allows for 5000 subscriptions via a single ServiceBusClient. I would expect both of the SDKs to have the same limits.
Screenshots
Setup (please complete the following information):
Additional context
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: