Skip to content

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Oct 10, 2025

This commit fixes the following crash for a GET or a PUT on HTTP API path /api/operator-policies/vhost/name if the supplied vhost doesn't exists:

crasher:
  initial call: cowboy_stream_h:request_process/3
  pid: <0.688.0>
  registered_name: []
  exception error: no function clause matching
                   rabbit_db_rtparams:get({not_found,<<"operator_policy">>,
                                           <<"my_policy">>}) (rabbit_db_rtparams.erl:145)
    in function  rabbit_runtime_parameters:lookup0/2 (rabbit_runtime_parameters.erl:363)
    in call from rabbit_runtime_parameters:lookup/3 (rabbit_runtime_parameters.erl:336)
    in call from rabbit_policy:lookup_op/2 (rabbit_policy.erl:326)
    in call from rabbit_mgmt_wm_operator_policy:resource_exists/2 (rabbit_mgmt_wm_operator_policy.erl:38)
    in call from cowboy_rest:call/3 (src/cowboy_rest.erl:1577)
    in call from cowboy_rest:expect/6 (src/cowboy_rest.erl:1560)
    in call from cowboy_rest:upgrade/4 (src/cowboy_rest.erl:281)

Also, instead of returning a 500 response code, RabbitMQ will now return a 404 response code.


This is an automatic backport of pull request #14717 done by [Mergify](https://mergify.com).

This commit fixes the following crash for a GET or a PUT on HTTP API
path `/api/operator-policies/vhost/name` if the supplied `vhost` doesn't
exists:
```
crasher:
  initial call: cowboy_stream_h:request_process/3
  pid: <0.688.0>
  registered_name: []
  exception error: no function clause matching
                   rabbit_db_rtparams:get({not_found,<<"operator_policy">>,
                                           <<"my_policy">>}) (rabbit_db_rtparams.erl:145)
    in function  rabbit_runtime_parameters:lookup0/2 (rabbit_runtime_parameters.erl:363)
    in call from rabbit_runtime_parameters:lookup/3 (rabbit_runtime_parameters.erl:336)
    in call from rabbit_policy:lookup_op/2 (rabbit_policy.erl:326)
    in call from rabbit_mgmt_wm_operator_policy:resource_exists/2 (rabbit_mgmt_wm_operator_policy.erl:38)
    in call from cowboy_rest:call/3 (src/cowboy_rest.erl:1577)
    in call from cowboy_rest:expect/6 (src/cowboy_rest.erl:1560)
    in call from cowboy_rest:upgrade/4 (src/cowboy_rest.erl:281)
```

Also, instead of returning a 500 response code, RabbitMQ will now return a 404
response code.

(cherry picked from commit bc0885c)
@mergify mergify bot assigned ansd Oct 10, 2025
@ansd ansd merged commit f7421a1 into v4.2.x Oct 10, 2025
575 of 576 checks passed
@ansd ansd deleted the mergify/bp/v4.2.x/pr-14717 branch October 10, 2025 13:11
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.

1 participant