rabbitmq-stream-dotnet-client
rabbitmq-stream-dotnet-client copied to clipboard
Error during close consumer during the delivery
Bug found by @ricsiLT
When consumer.close()
raises an exception when there are still some deliver frames on the network.
Also, the client receives throw new ArgumentException($"Unknown or unexpected tag: {tag}", nameof(tag));
for tag 9.
To reproduce the issue, it is enough to close the client when it is consuming a large number of messages for ex 5_000_000
:
var c2 = await ReliableConsumer.CreateReliableConsumer(new ReliableConsumerConfig()
{
StreamSystem = system,
Stream = streamName,
Reference = applicationName,
ClientProvidedName = "second",
OffsetSpec = new OffsetTypeFirst(),
MessageHandler = async (c, context, arg3) =>
{
Thread.Sleep(1);
}
});
Console.WriteLine("closing");
Thread.Sleep(10);
await c1.Close();
Logs on client side that indicate this issue:
Error removing the consumer id: 0 from the server. System.AggregateException: One or more errors occurred. (Unable to write data to the transport connection: An established connection was aborted by the software in your host machine..)
---> System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine..
---> System.Net.Sockets.SocketException (10053): An established connection was aborted by the software in your host machine.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.CreateException(SocketError error, Boolean forAsyncThrow)
Logs on server side that indicate this issue:
2022-07-29 09:15:40.104081+02:00 [warning] <0.8561.85> Giving credit to unknown subscription: 0
2022-07-29 09:15:43.106428+02:00 [warning] <0.8561.85> Giving credit to unknown subscription: 0
2022-07-29 09:16:11.714611+02:00 [warning] <0.8633.85> Giving credit to unknown subscription: 0
2022-07-29 09:16:14.716182+02:00 [warning] <0.8633.85> Giving credit to unknown subscription: 0
closed via https://github.com/rabbitmq/rabbitmq-stream-dotnet-client/pull/159