noxdafox / rabbitmq-message-deduplication

RabbitMQ Plugin for filtering message duplicates
Mozilla Public License 2.0
277 stars 34 forks source link

Exchange info crash after upgrade to 0.6.0 #97

Closed gomoripeti closed 1 year ago

gomoripeti commented 1 year ago

After upgrading the plugin and RabbitMQ from 0.5.4 (RMQ 3.10.x) to 0.6.0 (RMQ 3.11.5) with a message deduplication exchange that was already defined on the old version, opening the Exchanges management page results in the below crash (and HTTP 500)

crasher:
  initial call: cowboy_stream_h:request_process/3
  pid: <0.1210.0>
  registered_name: []
  exception error: no match of right hand side value nil
    in function  'Elixir.RabbitMQMessageDeduplication.Cache':cache_property/2 (lib/rabbitmq_message_deduplication/cache.ex, line 236)
    in call from 'Elixir.RabbitMQMessageDeduplication.Cache':info/1 (lib/rabbitmq_message_deduplication/cache.ex, line 135)
    in call from 'Elixir.RabbitMQMessageDeduplication.Exchange':info/2 (lib/rabbitmq_message_deduplication/rabbit_message_deduplication_exchange.ex, line 230)
    in call from rabbit_exchange:info/1 (rabbit_exchange.erl, line 370)
    in call from lists:map_1/2 (lists.erl, line 1320)
    in call from lists:map_1/2 (lists.erl, line 1320)
    in call from lists:map/2 (lists.erl, line 1315)
    in call from rabbit_mgmt_wm_exchanges:resource_exists/2 (rabbit_mgmt_wm_exchanges.erl, line 34)

There is a difference between user_properties of an old exchange and an exchange freshly defined on 0.6.0

1> mnesia:table_info(cache_exchange_vhost_msg_dedup_old, user_properties).
[{default_ttl,nil},{limit,1000}]
3> mnesia:table_info(cache_exchange_vhost_msg_dedup_new, user_properties).
[{distributed,true},
 {persistence,ram_copies},
 {size,500},
 {ttl,nil}]
noxdafox commented 1 year ago

Hi Péter,

Indeed I did not consider the previously created exchanges when changing the schema. I will roll out a fix ASAP.

Thanks for reporting this!

noxdafox commented 1 year ago

A fix has been pushed to main, I will test it in the upcoming days.

gomoripeti commented 1 year ago

thank you very much

noxdafox commented 1 year ago

Release 0.6.1 should fix this issue. Old caches are migrated to new layout.

Tested on single and multi-node layout:

Please note that a broker restart is required. Disabling and enabling again the plugin on a live broker is not functional at the moment.

Please re-open this issue if it persists.

Abhi7739309 commented 3 months ago

https://github.com/noxdafox/rabbitmq-message-deduplication/issues/97#issuecomment-1445419316