Skip to content

Commit

Permalink
Fix (*exemplarsStream).receive/(*metricMetadataStream).receive/(*targ…
Browse files Browse the repository at this point in the history
…etsStreamStream).receive infinite loop when target response Unimplemented error (thanos-io#4676)

Signed-off-by: hanjm <hanjinming@outlook.com>
  • Loading branch information
hanjm committed Sep 19, 2021
1 parent 5e33ef6 commit 1453fee
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 1453fee

Please sign in to comment.