-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Cryptic error "received a batch message with no data in it" when sending large messages in batch. #38260
Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist. |
Hi @arielpontes , There are a couple of subtle things going in the examples that you have posted. The service allows a single message to be sent or a batch of messages to be sent ( which is a special collection called When using a premium service bus you are able to send payloads up to 100 MB however they can only be sent as single messages. Batching is not supported Also batches have a max size of 1 mb in total on the premium tier, limits Any time a message is sent as a list, its converted in to a batch, so the only one that technically should go across is the last one. Ill try and repro the issue and see why you are getting the errors as shown. |
Hi @kashifkhan , thanks for the quick reply! Indeed I'm using the premium tier, and we updated the max message size to 2048 kb. Let me see if I understand it correctly though: the premium tier doesn't support batching at all? Most of our messages shouldn't be that large, so I would expect batching in this case to improve efficiency quite significantly by reducing overhead. Am I missing something? Should I really just drop the batching altogether and send the messages one by one without worrying too much about reduced efficiency? |
Hi @arielpontes, sorry my explanation was not clear
As long as your batches are less than 1 mb it should work in premium. We do have a bug in our error message that we have to address, but the functionality still works. which is why the following happens in your code
|
Thanks for the explanation! Things are getting clearer but I'm still trying to wrap my head around this issue. I tried to add the problematic message to a batch twice and got this error:
Didn't you say the maximum batch size is 1mb? According to this error it says the maximum batch size is 2mb. Is this another buggy error message that I shouldn't take at face value? Or when you said the "third batch fails as its larger than 1 mb", did you actually mean the "third batch fails as it has a message that is larger than 1 mb"? |
no worries @arielpontes , That is an error message from the sdk that is buggy and when fixed should say
So if you set your queue to accept messages of size 50 mb for ex, that means you can send single messages (one at a time) up to 50 mb. Batches however are still limited to 1 mb in premium ( 256 kb in standard ) and this means the size of the entire batch has to be less than that (there is some overhead involved so the actual payload has to be a little smaller than that). The third batch fails to send because the size of the batch has gone beyond 1 mb (and in this case because the single message itself is larger than 1 mb )
case 1 A single message that is greater than 2048 kb and therefore fails as the limit on the queue is 2048 kb for a single message message = ServiceBusMessage("test message " * 999_999)
sender.send_messages(message) case 2 A single message that is greater than 2048 and is being treated as a batch because of the list. The batch goes above the 1 mb limit here and the error message should tell you the right limit ... this is a bug we have to fix. messages = [ServiceBusMessage("test message " * 999_999)]
sender.send_messages(messages) case 3 A single message that is greater than 1 mb and is being treated as batch because of the list. Even here the batch goes above the 1 mb limit and the error message should be the same as the one output from above but with the right batch limit ... same we need to fix this messages = [ServiceBusMessage("test message " * 99_999)]
sender.send_messages(messages) case 4 messages = [ServiceBusMessage("test message " * 9_999)]
sender.send_messages(messages) |
Got it. Thank you for the detailed explanation @kashifkhan ! Just to summarize: The
So basically I cannot use the pattern of adding messages to a batch within a try block until it raises an exception because it's full. I have to take care of managing the size of the batch myself until this bug is fixed. Is that accurate? |
@arielpontes yes that is correct. We are working on a fix for it asap so we can get it out in this months release. Sorry about the issues this is causing you, I will update the thread once the PR is merged and we are ready to release to pypi |
Actually I can still use the same pattern, I just have to make sure to pass the
I ran some tests and it worked. Just leaving this here in case it's useful for someone else :) |
@arielpontes we have now released a new version of SB which addresses this, so you no longer have to use the mitigation |
Hi @arielpontes. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation. |
Describe the bug
Trying to write batches with large messages cause cryptic error.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
First two messages are not sent because they are too big, but the last two messages are sent.
What actually happens
I get this output:
I would expect the third message to be sent, but if it's not I would at least expect the error to be more similar to the one I get for the third case:
azure.servicebus.exceptions.MessageSizeExceededError: ServiceBusMessageBatch has reached its size limit: 2097152
The text was updated successfully, but these errors were encountered: