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

pkg/rules/proxy: fix hotlooping when receiving client errors #3732

Closed
wants to merge 1 commit into from

Conversation

s-urbaniak
Copy link
Contributor

Currently, if we receive an error from the underlying client stream,
we continue with trying to receive additional data.
This causes a hotloop as we will receive the same error again.
This fixes it by returning in the error case and adds a unit test for the proxy logic.

Fixes #3717

Signed-off-by: Sergiusz Urbaniak sergiusz.urbaniak@gmail.com

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Verification

Added unit tests, without the fix the unit test will hotloop.

cc @bwplotka @kakkoyun @squat

@s-urbaniak s-urbaniak force-pushed the fix-3717 branch 2 times, most recently from f30a4e3 to 5b9c955 Compare January 21, 2021 10:59
Copy link
Member

@squat squat left a comment

Choose a reason for hiding this comment

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

looks great @s-urbaniak :)

Copy link
Member

@onprem onprem left a comment

Choose a reason for hiding this comment

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

LGTM!

@onprem
Copy link
Member

onprem commented Jan 21, 2021

@squat Does it makes sense to get this fix released with 18.0?

@squat
Copy link
Member

squat commented Jan 21, 2021

yes, it very much could make sense. In this case, @s-urbaniak, I would ask that you make the pr against the release-0.18 branch instead. We would later merge this into main.

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Amazing, let's do same on release-0.18?

pkg/rules/proxy.go Outdated Show resolved Hide resolved
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Some extra tips

pkg/rules/proxy_test.go Outdated Show resolved Hide resolved
pkg/rules/proxy_test.go Outdated Show resolved Hide resolved
pkg/rules/proxy_test.go Outdated Show resolved Hide resolved
Currently, if we receive an error from the underlying client stream,
we continue with trying to receive additional data.
This causes a hotloop as we will receive the same error again.
This fixes it by returning in the error case and adds a unit test for the proxy logic.

Fixes thanos-io#3717

Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
@s-urbaniak
Copy link
Contributor Author

@bwplotka thank you for the review! 💚 PTAL for final review :)

@s-urbaniak
Copy link
Contributor Author

Submitted #3734 for the 0.18 backport.

@squat
Copy link
Member

squat commented Jan 21, 2021

Mmm rather than doing this in both branches, we should do what we always do which is merge in the release branch and then merge the release branch into the master branch no? If we all agree then I'll close this PR

@s-urbaniak
Copy link
Contributor Author

leaving up to the maintainers, i have both PRs open :-)

@onprem
Copy link
Member

onprem commented Jan 21, 2021

Mmm rather than doing this in both branches, we should do what we always do which is merge in the release branch and then merge the release branch into the master branch no? If we all agree then I'll close this PR

@squat Yeah let's close this and merge the PR in release branch. I don't think we will get a conflict but let's avoid polluting the git history with duplicate changes.

@squat squat closed this Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thanos rules fanout OOMs occasionally
4 participants