Skip to content

Unhelpful '500' failure when assigning an empty list of tickets #1266

@TBBle

Description

@TBBle

What happened:

Due to a local bug in my code, our Director sent an AssignTicketsRequest via REST to the backend containing an empty list of tickets.

We got a 500 error back from the RPC gateway without any useful information.

The om-backend logs contained only:

time="2020-10-09T12:38:09Z" level=error msg="failed to update assignments" app=openmatch component=app.backend error="ERR wrong number of arguments for 'mget' command"
time="2020-10-09T12:38:09Z" level=error msg="failed to update assignments for requested tickets" app=openmatch component=app.backend error="ERR wrong number of arguments for 'mget' command"

What you expected to happen:

Either:

  • No tickets were assigned, and life continues on; or
  • A failure indicating that 'no tickets' is not a rational AssignTicketsRequest.

In this case, the latter would have been more useful, and pointed me towards the real issue; but the former is quite acceptable, and fits the more-general use-case.

How to reproduce it (as minimally and precisely as possible):

Untested: Add a test similar to TestEmptyReleaseTicketsRequest to test an empty AssignTicketsRequest.

Anything else we need to know?:

The actual error message being logged is because we call the redis mget command with the ticket list, but mget fails when given an empty array, e.g., redis/node-redis#125.

I would suggest either this case be caught and short-cut to "success" before passing down to Redis, or the API be respecified to be 1-or-more ticket IDs so that code-gen won't let me call this sort of thing, and the server can send a 400-series error instead, so I know the call was incorrect.

(I'm not sure how the GRPC/REST bridge works, so I don't know if perhaps you would get a 400-series error automatically from the definition, or if perhaps you cannot actually specify "1-or-more ticket IDs" in the API spec)

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.11", GitCommit:"d94a81c724ea8e1ccc9002d89b7fe81d58f89ede", GitTreeState:"clean", BuildDate:"2020-03-12T21:08:59Z", GoVersion:"go1.12.17", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.9", GitCommit:"94f372e501c973a7fa9eb40ec9ebd2fe7ca69848", GitTreeState:"clean", BuildDate:"2020-09-16T13:47:43Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.):

Bare-metal Kubernetes cluster.

Open Match Release Version:

Open Match master, not sure of the exact date.

Install Method(yaml/helm)::

Helm subchart.

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions