A server-initiated channel.close frame can be sent together with other operations in a single TCP segment #13387
-
Describe the bugHello folks, I've encountered a strange behavior of the server that causes aio_pika to misbehave as well. Is the way it currently works intended and the bug is caused only by the library? Or both sides have issues here? Reproduction steps
Here is a script that reproduces the issue (python, aio_pika, docker): Expected behaviorThe server should stop writing any frames after it has closed the channel Additional contextI've tested that on 4.0.6 and 4.1.0-beta.4 using the script from above. Traffic dump from my test (see frame # 47) |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 10 replies
-
@anton-ryzhov you have multiple AMQP 0-9-1 frames in frame 47, starting with a Queues and streams do not verify if a channel is closed in order to avoid overhead that won't detect any issues an absolute majority of the time. They expect the channel process to shut down, which takes a moment, even if that means a few milliseconds.
Simply ignore those frames in aio-pika when the channel is not open according to the library's connection state. |
Beta Was this translation helpful? Give feedback.
-
@michaelklishin yeah, I see, that explains. Then I'll report the bug to |
Beta Was this translation helpful? Give feedback.
-
Related question. If it is expected to have frames sent to a closed channel — then the server doesn't follow this rule.
The server receives such frames and then terminates the whole connection (which also affects other channels). Shouldn't the server also ignore such frames or reply with |
Beta Was this translation helpful? Give feedback.
-
@anton-ryzhov yep, it's the
I reviewed the interaction between Client libraries must stop sending frames as soon as possible after receiving |
Beta Was this translation helpful? Give feedback.
-
I guess one thing channels could do is attach their state to the frame they want serialized and delivered. But that would entail extra GC pressure and memory copying for no benefit an overwhelming majority of the time. |
Beta Was this translation helpful? Give feedback.
@anton-ryzhov yep, it's the
basic.publish
that causes the connection to be closed. I hacked in the info in my local dev setup: