Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DELETE /api/policies/{vhost}/{policy} fails with a 500 on non existing vhosts #9983

Closed
ccodreanu opened this issue Nov 25, 2023 · 1 comment
Labels
Milestone

Comments

@ccodreanu
Copy link

ccodreanu commented Nov 25, 2023

Describe the bug

RabbitMQ 3.12.10

The request fails with a 500

Reproduction steps

  1. Run DELETE /api/policies/{vhost}/{policy} on a non existing vhost
  2. Get 500

Expected behavior

  1. Run DELETE /api/policies/{vhost}/{policy} on a non existing vhost
  2. Get 404

Additional context

Related: the messaging-topology-operator errors out blocking Policy deletions in Kubernetes.

Personally I'd expect to get a 404 for a non existing Vhost, but I might be missing knowledge :D.

Some logs logged:

{
  "v": 3,
  "time": 1700924704415802,
  "msg": "  crasher:\n    initial call: cowboy_stream_h:request_process/3\n    pid: <0.166058.0>\n    registered_name: []\n    exception error: no function clause matching \n rabbit_db_rtparams:get({not_found,<<\"policy\">>,\n                                             <<\"cata\">>}) (rabbit_db_rtparams.erl, line 95)\n      in function  rabbit_runtime_parameters:lookup0/2 (rabbit_runtime_parameters.erl, line 351)\n      in call from rabbit_runtime_parameters:lookup/3 (rabbit_runtime_parameters.erl, line 311)\n      in call from rabbit_policy:lookup/2 (rabbit_policy.erl, line 320)\n      in call from rabbit_mgmt_wm_policy:resource_exists/2 (rabbit_mgmt_wm_policy.erl, line 37)\n      in call from cowboy_rest:call/3 (src/cowboy_rest.erl, line 1583)\n      in call from cowboy_rest:expect/6 (src/cowboy_rest.erl, line 1566)\n      in call from cowboy_rest:upgrade/4 (src/cowboy_rest.erl, line 284)\n    ancestors: [<0.166057.0>,<0.57728.0>,<0.57719.0>,<0.57718.0>,\n                  <0.57716.0>,rabbit_web_dispatch_sup,<0.54998.0>]\n    message_queue_len: 0\n    messages: []\n    links: [<0.166057.0>]\n    dictionary: []\n    trap_exit: false\n    status: running\n    heap_size: 4185\n    stack_size: 28\n    reductions: 1650\n  neighbours:\n",
  "domain": "otp.sasl",
  "file": "proc_lib.erl",
  "line": 584,
  "pid": "<0.166058.0>",
  "error_logger": {
    "tag": "error_report",
    "type": "crash_report"
  },
  "gl": "<0.54997.0>",
  "logger_formatter": {
    "title": "CRASH REPORT"
  },
  "mfa": [
    "proc_lib",
    "crash_report",
    4
  ],
  "report_cb": "fun proc_lib:report_cb/2"
}

{
  "v": 3,
  "time": 1700924704416230,
  "msg": "Ranch listener {acceptor,{0,0,0,0},15672}, connection process <0.166057.0>, stream 1 had its request process <0.166058.0> exit with reason function_clause and stacktrace [{rabbit_db_rtparams,get,[{not_found,<<\"policy\">>,<<\"cata\">>}],[{file,\"rabbit_db_rtparams.erl\"},{line,95}]},{rabbit_runtime_parameters,lookup0,2,[{file,\"rabbit_runtime_parameters.erl\"},{line,351}]},{rabbit_runtime_parameters,lookup,3,[{file,\"rabbit_runtime_parameters.erl\"},{line,311}]},{rabbit_policy,lookup,2,[{file,\"rabbit_policy.erl\"},{line,320}]},{rabbit_mgmt_wm_policy,resource_exists,2,[{file,\"rabbit_mgmt_wm_policy.erl\"},{line,37}]},{cowboy_rest,call,3,[{file,\"src/cowboy_rest.erl\"},{line,1583}]},{cowboy_rest,expect,6,[{file,\"src/cowboy_rest.erl\"},{line,1566}]},{cowboy_rest,upgrade,4,[{file,\"src/cowboy_rest.erl\"},{line,284}]}]\n",
  "pid": "<0.166057.0>",
  "error_logger": {
    "tag": "error"
  },
  "gl": "<0.54997.0>",
  "report_cb": "#Fun<error_logger.0.17945318>"
}
@ccodreanu ccodreanu added the bug label Nov 25, 2023
@michaelklishin
Copy link
Member

3749   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>   crasher:
3750   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>     initial call: cowboy_stream_h:request_process/3
3751   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>     pid: <0.665.0>
3752   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>     registered_name: []
3753   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>     exception error: no function clause matching
3754   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>                      rabbit_db_rtparams:get({not_found,<<"policy">>,
3755   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>                                              <<"policy1">>}) (rabbit_db_rtparams.erl, line 135)
3756   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>       in function  rabbit_runtime_parameters:lookup0/2 (rabbit_runtime_parameters.erl, line 351)
3757   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>       in call from rabbit_runtime_parameters:lookup/3 (rabbit_runtime_parameters.erl, line 311)
3758   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>       in call from rabbit_policy:lookup/2 (rabbit_policy.erl, line 331)
3759   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>       in call from rabbit_mgmt_wm_policy:resource_exists/2 (rabbit_mgmt_wm_policy.erl, line 37)
3760   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>       in call from cowboy_rest:call/3 (cowboy_rest.erl, line 1583)
3761   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>       in call from cowboy_rest:expect/6 (cowboy_rest.erl, line 1566)
3762   │ 2023-11-25 18:52:27.983103-05:00 [error] <0.665.0>       in call from cowboy_rest:upgrade/4 (cowboy_rest.erl, line 284)

is what the node logs.

@michaelklishin michaelklishin added this to the 3.12.11 milestone Nov 26, 2023
mergify bot pushed a commit that referenced this issue Nov 26, 2023
(cherry picked from commit cc3084d)
mergify bot pushed a commit that referenced this issue Nov 26, 2023
(cherry picked from commit cc3084d)
(cherry picked from commit 45bcd1a)
michaelklishin added a commit that referenced this issue Nov 26, 2023
michaelklishin added a commit that referenced this issue Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants