Skip to content

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

@ccodreanu

Description

@ccodreanu

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>"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions