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

Distributor returns 500 HTTP status code on 400 from ingester #3210

Closed
Logiraptor opened this issue Oct 13, 2022 · 2 comments · Fixed by #3211
Closed

Distributor returns 500 HTTP status code on 400 from ingester #3210

Logiraptor opened this issue Oct 13, 2022 · 2 comments · Fixed by #3211
Labels
bug Something isn't working component/distributor

Comments

@Logiraptor
Copy link
Contributor

Describe the bug

Between weekly-r206 and weekly-r207 a regression was introduced that causes the distributor to return a 500 status code on receiving a 400 from the ingester. This is problematic because it means remote write clients will retry the request indefinitely despite it being invalid.

To Reproduce

Steps to reproduce the behavior:

  1. Start Mimir (weekly-r207)
  2. Write a too-old sample
  3. Observe that the ingester rejects with 400
  4. Observe that the distributor rejects with 500

Expected behavior

The distributor should reject with the same status code as ingester.

Environment

  • Infrastructure: [e.g., Kubernetes, bare-metal, laptop]
  • Deployment tool: [e.g., helm, jsonnet]

Additional Context

@Logiraptor
Copy link
Contributor Author

I think I know what the issue is.

#3055 wraps errors from the ingesters with errors.Wrap.
This changes the type of the error from status.ErrorProto created here:

return status.ErrorProto(&spb.Status{
Code: resp.Code,
Message: string(resp.Body),
Details: []*types.Any{a},
})

In turn, this makes the httpgrpc error handling break here:
if se, ok := err.(interface{ GRPCStatus() *status.Status }); ok {
return FromGRPCStatus(se.GRPCStatus()), true
}

The error no longer satisfies that interface.

@pr00se
Copy link
Contributor

pr00se commented Oct 13, 2022

Yes, any error that does not pass status.FromError() will be turned into a 500:

mimir/pkg/util/push/push.go

Lines 131 to 133 in d857bf9

if !ok {
http.Error(w, err.Error(), http.StatusInternalServerError)
return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component/distributor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants