-
Notifications
You must be signed in to change notification settings - Fork 592
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
"Serialized to wrong size" exception when call BasicPublish
#1620
Comments
For reference - https://groups.google.com/g/rabbitmq-users/c/oW1_PMRlbSA @AugustoDeveloper without a way to reproduce this issue, it's unlikely I will be able to fix it. If this issue were common, we would hear about it all of the time, yet it has only been reported twice. To start, you MUST let us know the following:
If you can share ALL of your code, I may be able to see what the issue is. |
RabbitMQ Version: 3.12.1 Well, i cant share everything, but i can show the method that calls private Task<PublishResult> PublishAsync(byte[] messageBody, string routingKey, CancellationToken cancellation)
{
return Task.Run(() =>
{
try
{
CreateBasicPropperties();
cancellation.ThrowIfCancellationRequested();
CurrentModel
.BasicPublish(Configuration.Exchange, routingKey, mandatory: false, Properties, messageBody);
return PublishResult.Published;
}
catch (Exception ex)
{
logger.LogError(ex, nameof(PublishAsync));
return PublishResult.Unpublished(messageBody, Configuration.Exchange, routingKey);
}
});
}
...
protected void CreateBasicPropperties()
{
if (Properties is null)
{
lock (lockProperties)
{
if (Properties is null)
{
Properties = CurrentModel.CreateBasicProperties();
Properties.DeliveryMode = PersistentDeliveryMode;
}
}
}
} |
Also, if you would like to really help out, please test your code with the latest version 7 RC, which supports async methods natively: https://www.nuget.org/packages/RabbitMQ.Client/7.0.0-rc.3 Please note that |
Ok, i will try, thank you very much. But just don't figure it out why in the version 5.1.1 of library this error not ocurring at all. Can you have any idea that's happen? The code still the same |
Something changed internally. |
That's works for me, thank you very much @lukebakken |
I'm not sure what you mean -
|
Sorry for not specified what fixed my problem, my problem was fixed using a new instance of IModel inside of async method |
Describe the bug
I updated the
RabbitMQ.Client
library to 6.8.1, before it was 5.1.1, and for some reason i receive some exceptions, but theInvalidOperationException
occurrs more frequently, with stack traceIn 4 hours range of time, this exception occurs 25 times. Unfortunately, i can't repro this error, but i needed to try if you guys can help me with some insights.
Reproduction steps
Well, thats the part i really confused, i can't reproduce, yet.
Expected behavior
In version 5.1.1 of
RabbitMQ.Client
this erros does not occurrs.Additional context
when this error is thrown my app reconnect to rabbitmq and retry publish for 3 times and it works, the message is published
The text was updated successfully, but these errors were encountered: