Skip to content

Commit

Permalink
Merge pull request #489 from getsentry/txiao/fix/do-not-iterate-unclo…
Browse files Browse the repository at this point in the history
…sed-channel

fix(flamegraphs): Do not iterate unclosed channel
  • Loading branch information
Zylphrex authored Jul 22, 2024
2 parents f0ea408 + cbbf824 commit 004683b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- Reuse one http client across different requests ([#458](https://github.com/getsentry/vroom/pull/458))
- Fix correct in_app classification for `[Native]` js frames ([#464](https://github.com/getsentry/vroom/pull/464))
- Ignore react-native js frame for metrics aggregation when not symbolicated ([#465](https://github.com/getsentry/vroom/pull/465))
- Do not iterate unclosed channel ([#489](https://github.com/getsentry/vroom/pull/489))

**Internal**:

Expand Down
8 changes: 6 additions & 2 deletions internal/flamegraph/flamegraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,9 @@ func GetFlamegraphFromCandidates(
) (speedscope.Output, error) {
hub := sentry.GetHubFromContext(ctx)

results := make(chan storageutil.ReadJobResult, len(transactionProfileCandidates)+len(transactionProfileCandidates))
numCandidates := len(transactionProfileCandidates) + len(continuousProfileCandidates)

results := make(chan storageutil.ReadJobResult, numCandidates)
defer close(results)

for _, candidate := range transactionProfileCandidates {
Expand Down Expand Up @@ -454,7 +456,9 @@ func GetFlamegraphFromCandidates(

var flamegraphTree []*nodetree.Node

for res := range results {
for i := 0; i < numCandidates; i++ {
res := <-results

err := res.Error()
if err != nil {
if errors.Is(err, storageutil.ErrObjectNotFound) {
Expand Down

0 comments on commit 004683b

Please sign in to comment.