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 Mar 9, 2026
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:vm_memory_high_watermark:vm_memory_limit:disk_free_limit:disk_freeCloses #15678.
This is an automatic backport of pull request #15680 done by Mergify.