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

ScheduleMessage returns timeout on exceeded message size #697

Open
jsquire opened this issue Feb 9, 2024 · 9 comments
Open

ScheduleMessage returns timeout on exceeded message size #697

jsquire opened this issue Feb 9, 2024 · 9 comments

Comments

@jsquire
Copy link
Member

jsquire commented Feb 9, 2024

Issue Transfer

This issue has been transferred from the Azure SDK for .NET repository, #41869.
Service Bus Team: It appears that the service is not rejecting the message outright nor sending the client an error code to indicate that the message size was exceeded.

Please be aware that @erik-neumann is the author of the original issue and include them for any questions or replies.

Details

Describe the bug

We're enountering a different behavior when trying to send or schedule a message that exceeds the maximum size.

When sending the message, immediatly (or at least very quickly) a ServiceBusException is thrown: "The message (id:xyz, size:262152 bytes) is larger than is currently allowed (262144 bytes). (MessageSizeExceeded)."

When trying to schedule the message, a ServiceBusException is thrown after 10 secs: "The operation was canceled. (ServiceTimeout)". This is per default, in our production environment this timeout is reached very late because of retry configuration.

Expected behavior

Same behavior when sending or scheduling a message that exceeds allowed size, returning a ServiceBusException (MessageSizeExceeded) immediatly.

Actual behavior

ScheduleMessage returns timeout after 10 secs.

Reproduction Steps

[TestClass]
public class UnitTest1
{
    private readonly ServiceBusSender _sender;

    public UnitTest1()
    {
        var client =
            new ServiceBusClient("connectionString");
        _sender = client.CreateSender("messagesize-test");
    }

    [TestMethod]
    public async Task SendMessage()
    {
        var message = CreateMessage(262144);
        // This fails immediatly
        await _sender.SendMessageAsync(message);
    }

    [TestMethod]
    public async Task ScheduleMessage()
    {
        var message = CreateMessage(262144);
        // This fails after timeout
        await _sender.ScheduleMessageAsync(message, DateTimeOffset.Now.AddMinutes(1));
    }

    private static ServiceBusMessage CreateMessage(int size)
    {
        var payload = Encoding.ASCII.GetBytes(string.Concat(Enumerable.Repeat("0", size)));
        return new ServiceBusMessage(payload);
    }
}

Environment

Runtime Environment:
OS Name: Mac OS X
OS Version: 14.1
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.101/

@jsquire
Copy link
Member Author

jsquire commented Feb 9, 2024

//fyi: @EldertGrootenboer

@EldertGrootenboer
Copy link
Contributor

Thank you for your feedback. We have opened an investigation task for this in our backlog, and will update this issue when we have more information.

@vvamaraju
Copy link

Thank you EldertGrootenboer for helping on the reported issue. I'm the support engineer working on the subjected issue. Would like to understand if you have some update for us on the same. Thank you so much in advance.

@anqyan
Copy link

anqyan commented Feb 21, 2024

@jsquire Seems it is caused by lacking message size check in AmqpSender.ScheduleMessageInternalAsync of SDK.
We have the message size check in AmqpSender.SendBatchInternalAsync, we should add the similar check to ScheduleMessageInternalAsync.

The timeout was caused by swallowing of the message size exception (thrown by ReceivingAmqpLink.OnProcessTransfer) in AmqpLink.ProcessFrame in service side code, which is by design.

@jsquire
Copy link
Member Author

jsquire commented Feb 21, 2024

@anqyan. This is by design. The SDK only validates message sizes when attempting to add to ServiceBusMessageBatch. For any API that works against a message or set of messages, the client intentionally does not measure and relies on the service to enforce its limitations.

The service must perform its own validation and return an error to callers that provides them the information necessary to troubleshoot; the service cannot assume that an official Azure SDK package is what is calling it. For example, callers using Apache QPid to directly invoke the service should receive a meaningful error when the message size is exceeded.

@anqyan
Copy link

anqyan commented Feb 22, 2024

Service side investigations: Incident 471119503 : MessageSizeExceeded excepiton is not thrown for Scheduled messages.

@erik-neumann
Copy link

Hi @anqyan, is there any update on the issue? I was told it might take a couple of weeks to address the issue, and two months have passed since then.

@EldertGrootenboer
Copy link
Contributor

We have brought this item in our current planning. We don't have a specific date when development will start for this, once we have more information around this, we will update this thread.

@erik-neumann
Copy link

Now that another 3 months have passed, I fear the item has been put on hold. Is there any plan or progress with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants