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

[r161] Clone the diff in GRPC streaming to prevent panics #3970

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,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