Skip to content

Commit

Permalink
Bug 2074413: Thanos Querier high CPU and memory usage till OOM
Browse files Browse the repository at this point in the history
This cherry-picks upstream patch that fixes the bug

Query: Fix (*exemplarsStream).receive/(*metricMetadataStream).receive/(*targetsStreamStream).receive
  infinite loop when target response Unimplemented error (thanos-io#4676) (thanos-io#4681)

See:
  - thanos-io#4676 (comment)
  - thanos-io#4681

Signed-off-by: hanjm <hanjinming@outlook.com>
(cherry picked from commit 2d4d140)

Signed-off-by: Sunil Thaha <3005132+sthaha@users.noreply.github.com>
  • Loading branch information
sthaha committed Apr 12, 2022
1 parent e0fa82c commit 9997d02
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/exemplars/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ func (stream *exemplarsStream) receive(ctx context.Context) error {
if err := stream.server.Send(exemplarspb.NewWarningExemplarsResponse(err)); err != nil {
return errors.Wrapf(err, "sending exemplars error to server %v", stream.server)
}

continue
// Not an error if response strategy is warning.
return nil
}

if w := exemplar.GetWarning(); w != "" {
Expand Down
3 changes: 2 additions & 1 deletion pkg/metadata/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ func (stream *metricMetadataStream) receive(ctx context.Context) error {
return errors.Wrapf(err, "sending metadata error to server %v", stream.server)
}

continue
// Not an error if response strategy is warning.
return nil
}

if w := resp.GetWarning(); w != "" {
Expand Down
4 changes: 2 additions & 2 deletions pkg/targets/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ func (stream *targetsStream) receive(ctx context.Context) error {
if err := stream.server.Send(targetspb.NewWarningTargetsResponse(err)); err != nil {
return errors.Wrapf(err, "sending targets error to server %v", stream.server)
}

continue
// Not an error if response strategy is warning.
return nil
}

if w := target.GetWarning(); w != "" {
Expand Down

0 comments on commit 9997d02

Please sign in to comment.