funcmike / rabbitmq-nio

A Swift implementation of AMQP 0.9.1 protocol: decoder + encoder and non-blocking client
Apache License 2.0
44 stars 8 forks source link

Closing the channel after cancelling an AMQPSequence (consume) sometimes throws an .invalidResponse error #31

Closed sliemeobn closed 1 year ago

sliemeobn commented 1 year ago

I created a reproducer test here, sometimes it works, sometimes it fails - I added a loop around to force it

https://github.com/sliemeobn/rabbitmq-nio/blob/1a9b6901d1dd8381416172115423989c61fe7646/Tests/AMQPClientTests/AMQPChannelTest.swift#L322-L345

My theory is that there the cancellation and the channel-close responses get mixed up, at least I see that a Basic.cancel response ends up in here: https://github.com/funcmike/rabbitmq-nio/blob/d6c79ed2430b248d71ddbebd76d14abb7783e610/Sources/AMQPClient/AMQPChannel.swift#L50-L53

sliemeobn commented 1 year ago

could also be connected to this: https://github.com/funcmike/rabbitmq-nio/blob/09324fd13c2242f9eef44d524a7b76308fdec0f7/Sources/AMQPClient/AMQPChannel.swift#L191-L194

noWait in message is set to false -> so the broker will respond with a cancel response but the client will not be expecting it