rabbitmq-diagnostics status: handle nil vm_memory_high_watermark#15678
Closed
jalju0804 wants to merge 1 commit intorabbitmq:mainfrom
Closed
rabbitmq-diagnostics status: handle nil vm_memory_high_watermark#15678jalju0804 wants to merge 1 commit intorabbitmq:mainfrom
jalju0804 wants to merge 1 commit intorabbitmq:mainfrom
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>
Collaborator
|
Thank you. Your proposed solution is on the right track. #15680 extends it a bit more. |
mergify bot
pushed a commit
that referenced
this pull request
Mar 9, 2026
(cherry picked from commit 628eee8)
Collaborator
|
Accepted with a few exceptions in #15680. |
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.
Fixes #15679
Why
When a node is in maintenance mode, the
vm_memory_monitorGenServer is not running.rabbit_misc:filter_exit_map/2inrabbit.erlsilently drops the:vm_memory_high_watermarkkey from the status result keyword list when the process call exits.Keyword.get(result, :vm_memory_high_watermark)therefore returnsnil, andnil |> Memory.formatted_watermark/1crashes with aFunctionClauseErrorbecause no clause matchesnil.This crash affects both
rabbitmq-diagnostics statusandrabbitmqctl statuswhen run against a node that has been put into maintenance mode.Stack Trace
Changes
memory.ex: add anilclause toformatted_watermark/1that returnsnil, so the JSON formatter path completes without crashing.status_command.ex: add anilbranch to thereadable_watermark_settingcase expression so the text formatter outputs(unknown)instead of crashing.This is the same crash location as #2964, but triggered by
nilinstead of{:relative, float}.Checklist
CONTRIBUTING.mdrelease-notes/