Skip to content
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

Somehow Channel.QueueDeclare "exclusive" and "durable" flags are mutually infuenced #373

Closed
SergeAx opened this issue Dec 3, 2018 · 5 comments

Comments

@SergeAx
Copy link

SergeAx commented Dec 3, 2018

Here is a minimal example:

package main

import (
	"fmt"

	"github.com/streadway/amqp"
)

func main() {
	conn, _ := amqp.Dial("amqp://guest:guest@localhost/")
	defer conn.Close()
	ch, _ := conn.Channel()
	defer ch.Close()
	q1, err := ch.QueueDeclare("test_qqq", /* durable: */ true, false, /* exclusive: */ false, false, nil)
	handle(err)
	fmt.Println("%+v", q1)
	q2, err := ch.QueueDeclare("test_qqq", /* durable: */ true, false, /* exclusive: */ true, false, nil)
	handle(err)
	fmt.Println("%+v", q2)
}

func handle(err error) {
	if err != nil {
		panic(fmt.Sprintf("%v", err))
	}
}

Using:

  • amqp version v0.0.0-20181107104731-27835f1a64e9
  • RabbitMQ 3.7.3 Erlang 20.2

As you can see, in this example I am trying to recreate same queue twice, first with exclusive:true, then with exclusive:false. It fails as expected, but produces unexpected error message:

Exception (406) Reason: "PRECONDITION_FAILED - inequivalent arg 'durable' for queue 'test_qqq' in vhost '/': received 'false' but current is 'true'"

I spent half an hour looking blankly at my durable: true statement, but actually should be looking into exclusive argument. Is there a way to keep future users from such a loss of time? It should be like args 'durable' and 'exclusive' are in conflict with each other. Or is it RabbitMQ problem?

@michaelklishin
Copy link
Collaborator

See Declaration property equivalence in the Queues guide.

@SergeAx
Copy link
Author

SergeAx commented Feb 17, 2019

See Declaration property equivalence in the Queues guide.

I understand you may get tens complains like this every week, but i can assure you I've read the docs. The problem not in an error itself or its code, but in error message, which is misleading. It says I must set durable to true, which I already did. Or maybe you are saying that it is a RabbitMQ fault, not your package's, and I should file an issue in their repo?

@SergeAx
Copy link
Author

SergeAx commented Feb 17, 2019

Update: I've checked the package's source and can see now it's a problem on a RabbitMQ side, sorry. Case closed here.

@lukebakken
Copy link
Contributor

@SergeAx - rabbitmq/rabbitmq-server#1887

Basically, the presence of "exclusive" negates the durable argument, but durable is checked first. I'm fixing it now. Thanks for the code to reproduce the issue.

@michaelklishin
Copy link
Collaborator

@SergeAx apologies, I didn't spot the combination of properties you were using. Indeed most such questions come from complete beginners so I used a canned response.

michaelklishin added a commit to ruby-amqp/bunny that referenced this issue Feb 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants