Skip to content

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

Merged
michaelklishin merged 2 commits intomainfrom
rabbitmq-server-15678
Mar 9, 2026
Merged

rabbitmq-diagnostics status: handle nil values when target node was put into maintenance mode (originally by @jalju0804)#15680
michaelklishin merged 2 commits intomainfrom
rabbitmq-server-15678

Conversation

@michaelklishin
Copy link
Copy Markdown
Collaborator

@michaelklishin michaelklishin 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.

jalju0804 and others added 2 commits March 9, 2026 11:57
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)
@michaelklishin michaelklishin added this to the 4.3.0 milestone Mar 9, 2026
@michaelklishin michaelklishin changed the title rabbitmq-diagnostics status: handle nil values when target node is under maintenance mode (originally by @jalju0804) rabbitmq-diagnostics status: handle nil values when target node was put into maintenance mode (originally by @jalju0804) Mar 9, 2026
@michaelklishin michaelklishin merged commit a9f0cd2 into main Mar 9, 2026
181 of 182 checks passed
@michaelklishin michaelklishin deleted the rabbitmq-server-15678 branch March 9, 2026 19:24
michaelklishin added a commit that referenced this pull request Mar 9, 2026
`rabbitmq-diagnostics status`: handle `nil` values when target node was put into maintenance mode (originally by @jalju0804) (backport #15680)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants