Skip to content

Commit

Permalink
Clone the diff in GRPC streaming to prevent panics (#3961) (#3969)
Browse files Browse the repository at this point in the history
* clone diff

Signed-off-by: Joe Elliott <[email protected]>

* changelog

Signed-off-by: Joe Elliott <[email protected]>

* add similar logic to final

Signed-off-by: Joe Elliott <[email protected]>

---------

Signed-off-by: Joe Elliott <[email protected]>
(cherry picked from commit 89b8d7d)
  • Loading branch information
joe-elliott authored Aug 15, 2024
1 parent 5a6f140 commit d7ba0b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
* [BUGFIX] Fix prefix handling in Azure backend Find() call [#3875](https://github.com/grafana/tempo/pull/3875) (@zalegrala)
* [BUGFIX] **BREAKING CHANGE** Remove unused properties from the WAL configuration [#3911](https://github.com/grafana/tempo/pull/3911) (@javiermolinar)
* [BUGFIX] Bring back OTEL receiver metrics [#3917](https://github.com/grafana/tempo/pull/3917) (@javiermolinar)
* [BUGFIX] Correct block end time when the ingested traces are outside the ingestion slack [#3954](https://github.com/grafana/tempo/pull/3954) (@javiermolinar)
* [BUGFIX] Fix race condition where a streaming response could be marshalled while being modified in the combiner resulting in a panic. [#3961](https://github.com/grafana/tempo/pull/3961) (@joe-elliott)

## v2.5.0

Expand Down
8 changes: 6 additions & 2 deletions modules/frontend/combiner/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ func (c *genericCombiner[T]) GRPCFinal() (T, error) {
return empty, err
}

return final, nil
// clone the final response to prevent race conditions with marshalling this data
finalClone := proto.Clone(final).(T)
return finalClone, nil
}

func (c *genericCombiner[T]) GRPCDiff() (T, error) {
Expand All @@ -194,7 +196,9 @@ func (c *genericCombiner[T]) GRPCDiff() (T, error) {
return empty, err
}

return diff, nil
// clone the diff to prevent race conditions with marshalling this data
diffClone := proto.Clone(diff)
return diffClone.(T), nil
}

func (c *genericCombiner[T]) erroredResponse() (*http.Response, error) {
Expand Down

0 comments on commit d7ba0b1

Please sign in to comment.