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

Add recovery middleware to Ingester; re-add recovery middleware to Querier when not running in standalone mode #4349

Conversation

JordanRushing
Copy link
Contributor

@JordanRushing JordanRushing commented Sep 17, 2021

What this PR does / why we need it:
In #4301 we refactored the Querier but removed the recovery HTTP middleware from the Querier when not running in standalone mode.

Recently in production we observed an issue (fixed in #4308) where panics occurred in both the Querier and Ingester. The Queriers were able to recover but not the Ingesters.

Which issue(s) this PR fixes:
Fixes #4325.

Special notes for your reviewer:
N/A

Checklist

  • Documentation added
  • Tests updated

@JordanRushing JordanRushing requested a review from a team as a code owner September 17, 2021 21:12
@JordanRushing JordanRushing self-assigned this Sep 17, 2021
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch for #4301. I think Queriers are solved with this but not ingesters.

Ingesters read path is using GRPC so you need an interceptor. I did this a year ago here https://github.com/grafana/loki/blob/main/pkg/util/server/recovery.go#L35 from this PR https://github.com/grafana/loki/pull/2059/files

I think it has been removed by mistake here https://github.com/grafana/loki/pull/4153/files.

cc @owen-d to confirm.

Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #4301 we refactored the Querier but removed the recovery HTTP middleware from the Querier when not running in standalone mode.

I believe this is still handled here in registerRoutesExternally.

Nice catch @cyriltovena! @JordanRushing I think we can reintroduce these two lines to setupAuthMiddleware: https://github.com/grafana/loki/pull/4153/files#diff-f8d1e3ee4777a88e31fef8a16d19b415de6ef999ef259b0dd3dad3e42c6ca015L226-L227

Doing PR review for this one took a lot of file navigation and double-checking, which is probably a good signal that we should refactor this, but not needed now. I've had my eyes on the Cortex api pkg for a while now :)

pkg/loki/modules.go Show resolved Hide resolved
pkg/querier/worker_service.go Show resolved Hide resolved
@JordanRushing JordanRushing force-pushed the jordanrushing/loki/add-recovery-middleware-to-ingester branch from eaaa679 to 3103a19 Compare September 27, 2021 16:24
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@owen-d owen-d merged commit 5e8a204 into grafana:main Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure ingester queries use panic recovery middleware
3 participants