-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Link detach does not set closed to true #2594
Comments
Can you please provide a small example we can run with |
Looking at the code RabbitMQ replies without even inspecting the value of the incoming closed flag. Link recovery isn't supported by the plugin so we should probably always return closed=true for all detaches assuming this is allowed by the protocol. |
@michaelklishin Sure thing. Here's a minimal example: package main
import (
"log"
"pack.ag/amqp"
)
func main() {
// Create client
client, err := amqp.Dial("amqp://guest:guest@localhost:5672/")
if err != nil {
log.Fatal(err)
}
// Open a session
session, err := client.NewSession()
if err != nil {
log.Fatal("Creating AMQP session:", err)
}
// Create link
sender, err := session.NewSender(
amqp.LinkTargetAddress("/queue"),
)
if err != nil {
log.Fatal("Creating sender link:", err)
}
// Close link
sender.Close()
} Running as is it should just hang. If you run it with
|
That the amqp 1.0 plugin returns with closed=undefined (false) is established. The question here is what is the right thing to do given link recovery isn't supported. Ideally we'd only support link close frames with closed=true and error on anything else. Then we can reply with closed=true and all is well, protocol-wise. This could potentially break some clients if they don't always set the closed field to true and may be a bit too strict? Alternatively we could always return closed=true (whatever the input frame has set). If the client sent closed=false and then got closed=true back from the plugin it would then try to re-establish the link at which point it will get an error (as link recovery isn't supported). |
@kjnilsson I think returning an error is the right thing to do for now. |
I would argue do the simplest thing and just echo back what the peer initiating the deatch sent as the close flag. Detaching without close=true doesn't imply that the link can be resumed as the terminus can be deleted when detached. |
Fixed in RabbitMQ 4.0. |
Hi! I maintain an AMQP 1.0 client for Go (https://github.com/vcabbage/amqp). While investigating vcabbage/amqp#60 I noticed that closing a link was hanging.
It seems when the client send it's detach, with Closed=true, RabbitMQ responds with a detach with Closed=false. (Technically it's sending it with a null value for Closed, but the default is false.)
To my knowledge, non-closing detaches are used to detach from a link and reattach later. I'm not sure that's something RabbitMQ supports (my client doesn't). In any case, I believe it would be correct for RabbitMQ to respond with a closing detach.
The spec also says:
Do you agree with this assessment? I can provide debug logs and/or packet captures if it would be helpful.
Thanks!
The text was updated successfully, but these errors were encountered: