Skip to content

rabbitmq-diagnostics status: handle nil values when target node was put into maintenance mode (originally by @jalju0804) (backport #15680)#15681

Merged
michaelklishin merged 2 commits intov4.2.xfrom
mergify/bp/v4.2.x/pr-15680
Mar 9, 2026
Merged

rabbitmq-diagnostics status: handle nil values when target node was put into maintenance mode (originally by @jalju0804) (backport #15680)#15681
michaelklishin merged 2 commits intov4.2.xfrom
mergify/bp/v4.2.x/pr-15680

Conversation

@mergify
Copy link
Copy Markdown

@mergify mergify bot commented Mar 9, 2026

Reported by @jalju0804 in #15678 with a proposed fix in #15679.

The fix is generally on the right track but can be done a bit more thoroughly and cover more keys, plus use a slightly more consistent language.

The nil-safe keys in this scenario are now

  1. :vm_memory_high_watermark
  2. :vm_memory_limit
  3. :disk_free_limit
  4. :disk_free

Closes #15678.


This is an automatic backport of pull request #15680 done by Mergify.

jalju0804 and others added 2 commits March 9, 2026 19:25
When a node is put into maintenance mode (or vm_memory_monitor is
otherwise unavailable), rabbit_misc:filter_exit_map/2 in rabbit.erl
silently drops the :vm_memory_high_watermark key from the status
result. This causes Keyword.get/2 to return nil, which is then piped
into formatted_watermark/1. Since no function clause matched nil,
the command crashed with a FunctionClauseError.

Add a nil clause to formatted_watermark/1 in Memory that returns nil,
and handle nil in the readable_watermark_setting case expression in
StatusCommand so the text formatter outputs "(unknown)" instead of
crashing.

Fixes the Kolla-Ansible upgrade task failure:
  rabbitmq-diagnostics --formatter json status -n rabbit
  Error: :function_clause
  RabbitMQ.CLI.Core.Memory.formatted_watermark/1

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit dfbf7c3)
(cherry picked from commit c9d8012)
(cherry picked from commit 628eee8)
@michaelklishin michaelklishin reopened this Mar 9, 2026
@michaelklishin michaelklishin added this to the 4.2.5 milestone Mar 9, 2026
@michaelklishin michaelklishin merged commit db88e77 into v4.2.x Mar 9, 2026
582 of 875 checks passed
@michaelklishin michaelklishin deleted the mergify/bp/v4.2.x/pr-15680 branch March 9, 2026 20:08
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.

2 participants