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

Handle generic data structures in priority queue info callback #1669

Merged
merged 1 commit into from
Aug 13, 2018

Conversation

noxdafox
Copy link
Contributor

@noxdafox noxdafox commented Aug 12, 2018

The priority queue implementation makes assumptions over the
data format returned by the underlying backing queue
info callback.

This causes priority queues to crash if used together with other
modules implementing the rabbit_backing_queue behaviour and
returning additional data with the info callback.

As we cannot predict the format of the data the backing queue
info callback could return, we just replace it with the undefined
keyword.

Signed-off-by: Matteo Cafasso noxdafox@gmail.com

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (correction or otherwise)
  • Cosmetics (whitespace, appearance)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask on the
mailing list. We're here to help! This is simply a reminder of what we are
going to look for before merging your code.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

Notice this when investigating an issue in my plugin.

If a module implementing the rabbit_backing_queue behaviour wants to enrich the information returned by the info callback (more particularly, the :backing_queue_status information) will end up crashing the queue if used together with priorities.

The priority queue implementation makes assumptions over the
data format returned by the underlying backing queue
`info` callback.

This causes priority queues to crash if used together with other
modules implementing the `rabbit_backing_queue` behaviour and
returning additional data with the `info` callback.

As we cannot predict the format of the data the backing queue
`info` callback could return, we just replace it with the undefined
keyword.

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
@pivotal-issuemaster
Copy link

@noxdafox Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@michaelklishin
Copy link
Member

Thank you!

@lukebakken
Copy link
Collaborator

Hi @noxdafox - do you have an example of a crash with a stack trace or a set of steps to reproduce a crash?

@noxdafox
Copy link
Contributor Author

noxdafox commented Aug 13, 2018

Hello @lukebakken, you can find the stack trace and the steps to reproduce it in the issue I linked in the comment above.

Copy link
Collaborator

@lukebakken lukebakken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noxdafox - rather than changing behavior here, could you pass a compatible term here instead, if the queue is a priority queue?

I'd rather keep the "crash on unexpected / malformatted" data behavior here.

@noxdafox
Copy link
Contributor Author

noxdafox commented Aug 13, 2018

I don't think that's the correct way to handle the problem.

The rabbit_backing_queue behaviour is currently not setting any restriction to the format of the data the info callback must return. Therefore, claiming that the data is "unexpected or malformatted" is incorrect.

This implies that any implementation of the behaviour is supposed to keep that into account. Nevertheless, the priority-queue implementation is enforcing a data format and by doing that it violates the API contract. Encouraging this violations severely hinders the scalability of the design.

We can in fact imagine what would happen if there would be more than one or two implementations of the rabbit_backing_queue behaviour. A developer should check all the quirks of the other implementations to cope with his/her own.

A better solution would indeed consist in defining a data format for the info callback which all other implementations could adhere to. This would also facilitate the folding/unfolding the priority-queue implementation is doing as it could rely on such format restrictions.

I am open towards such design and willing to commit to it. But I'd rather not delve into the priority-queue logic to find a way around to fit my data into. At that point, the current workaround I implemented (not reporting any info if x-max-priority is set) is more than enough.

@lukebakken
Copy link
Collaborator

@noxdafox good enough explanation for me.

@lukebakken lukebakken merged commit d35fe7c into rabbitmq:master Aug 13, 2018
@michaelklishin michaelklishin added this to the 3.7.8 milestone Aug 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants