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

Bugfix: crash during startup because of missing 'x-delayed-type' #620

Merged
merged 2 commits into from
Jan 8, 2024

Conversation

spuun
Copy link
Member

@spuun spuun commented Dec 28, 2023

WHAT is this pull request doing?

If a delayed exchange was declared with type=x-delayed-message and arguments={x-delayed-type: '…'} and LavinMQ crashed before definitions has been compacted, it couldn't start again because of:
Unhandled exception: Missing required argument 'x-delayed-type' (LavinMQ::Error::ExchangeTypeError)

In LavinMQ any exchange can be delayed by specifiy x-delayed-exchange: true in exchange arguments, and declare frames with type=x-delayed-message was converted to type=<value of x-delayed-type> with arguments={x-delayed-exchange: true}. However, the original frame was stored to the definition file, but with modified arguments causing the crash on startup, i.e. the frame had type=x-delayed-message but no x-delayed-type in the arguments table.

This change will make sure to clone the arguments table before modifying it.

HOW can this pull request be tested?

Specs, or run lavinmq and declare a delayed exchange with type=x-delayed-message then kill -9 lavinmq and try start it.

@carlhoerberg
Copy link
Member

Can definitions with delayed exchanges be exported and then imported in Rabbit?

@kickster97
Copy link
Member

kickster97 commented Dec 28, 2023

Can definitions with delayed exchanges be exported and then imported in Rabbit?

it will not crash, but they are not compatible.. the exchange will be created on the rabbitmq broker but the x-delayed-exchange: true will be in the arguments rather than the actual type.

To make it fully compatible would probably require a refactor of make_exchange in Vhost

@carlhoerberg carlhoerberg merged commit 75fcf09 into main Jan 8, 2024
24 of 26 checks passed
@carlhoerberg carlhoerberg deleted the bugfix-delayed-exchange-broken-definitions branch January 8, 2024 14:12
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.

3 participants