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

Inconsistent type for channel_details when requesting queue admin data #2684

Closed
tiljanssen opened this issue Dec 15, 2020 · 3 comments · Fixed by #7040
Closed

Inconsistent type for channel_details when requesting queue admin data #2684

tiljanssen opened this issue Dec 15, 2020 · 3 comments · Fixed by #7040

Comments

@tiljanssen
Copy link

tiljanssen commented Dec 15, 2020

The response to /api/queues/%2f/{queuename} has a consumer_details array of objects, where one of the fields is channel_details.
This field is an object if filled, but an empty array when no data is available.

In most cases the consumer_details array is empty, or there is a consumer and the channel_details are filled, but occasionally the a consumer_detail is returned with empty channel_details. I am using C# and the Json deserializer cannot handle the array where it expects an object.

The problem occurs in a test setup where consumers are short-lived. The behavior causes a highly unreliable test result.

RabbitMq version is 3.8.9, before this version we used 3.7.19 where we did not experience this problem.

@michaelklishin
Copy link
Member

This is rabbitmq/rabbitmq-management#701, rabbitmq/rabbitmq-management#75 and rabbitmq/rabbitmq-management#424 in a different place. With Erlang proplists there is no way to distinguish between an empty array and an empty object since they are lists of pairs.

I highly doubt this is something new in 3.8.

@Syuparn
Copy link
Contributor

Syuparn commented Jan 25, 2023

This still occurs in RabbitMQ 3.11.6 while a channel is being deleted.

# empty list appeared
$ curl -s http://user:pass@localhost:15672/api/queues/%2f/queue1 | jq .consumer_details[].channel_details
{
  "connection_name": "10.244.0.47:57414 -> 10.244.0.45:5672",
  "name": "10.244.0.47:57414 -> 10.244.0.45:5672 (1)",
  "node": "rabbit@rabbitmq-0.rabbitmq-headless.default.svc.cluster.local",
  "number": 1,
  "peer_host": "10.244.0.47",
  "peer_port": 57414,
  "user": "user"
}
[]

This can be fixed by adding a format function to https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_management_agent/src/rabbit_mgmt_format.erl#L543 as @michaelklishin suggested.

@deadtrickster
Is there any plan for this issue? If not, I will make a PR.

@michaelklishin
Copy link
Member

@Syuparn no need to ask for permission, you are welcome to submit a PR. Thanks.

@michaelklishin michaelklishin added this to the 3.11.8 milestone Jan 26, 2023
vitorquintanilha added a commit to vitorquintanilha/rabbit-hole that referenced this issue Sep 20, 2023
Because of rabbitmq/rabbitmq-server#2684, in
all RabbitMQ versions until 3.11.8, the
`.consumer_details.channel_details` attribute for a queue could be
sent as an empty array (`[]`) instead an empty object (`{}`).

This PR provides a fix to that by customizing the json serializarion
of ChannelDetails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants