Skip to content

Commit

Permalink
reporter: Fix io.EOF handling (#3010)
Browse files Browse the repository at this point in the history
The way the if statement was written, if there is an io.EOF error, then
we still first try reading the response object, however, in the io.EOF
case it's null, therefore the if statement needs to be swapped around so
it would never try to read something on the nil pointer if an io.EOF
error is returned.
  • Loading branch information
brancz authored Dec 16, 2024
2 parents 0ea54ad + 36d35f7 commit dc6e2c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion reporter/parca_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ func (r *ParcaReporter) reportDataToBackend(ctx context.Context, buf *bytes.Buff
if err != nil && err != io.EOF {
return err
}
if len(resp.Record) == 0 || err == io.EOF {
if err == io.EOF || len(resp.Record) == 0 {
// The backend didn't want any more information.
return nil
}
Expand Down

0 comments on commit dc6e2c7

Please sign in to comment.