Skip to content

Conversation

@owen-d
Copy link
Member

@owen-d owen-d commented Jun 21, 2024

No description provided.

Signed-off-by: Owen Diehl <ow.diehl@gmail.com>
@owen-d owen-d marked this pull request as ready for review June 24, 2024 15:11
@owen-d owen-d requested a review from a team as a code owner June 24, 2024 15:11
Comment on lines 116 to 124

defer func() {
for i := range bqs {
if bqs[i] == nil {
continue
}
bqs[i].Close()
}
}()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I miss something, but we don't seem to close the block remaining block queriers any more in case one p.processBlock() fails, since concurrency.ForEachJob() returns on first error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The closing has moved into processBlock itself so we can cleanup & return to the buffer pool as blocks individually finish, not after they all do. This also helps prevent issues if/when we start blocking on pool accesses where further blocks could hang waiting for Gets from the buffer pool that haven't been returned from previous blocks.

var errs multierror.MultiError
errs.Add(err)
errs.Add(bq.Close())
err = errs.Err()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks wrong, since on line 141 you add err to the multi-error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's capturing the err from the function signature and adding it to the multi-error (which can now have a main error from the body of the function call and/or an error from cleanup.

Signed-off-by: Owen Diehl <ow.diehl@gmail.com>
Copy link
Contributor

@chaudum chaudum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@owen-d owen-d merged commit 0cb3ff1 into grafana:main Jun 24, 2024
chaudum added a commit that referenced this pull request Jun 25, 2024
The slice of block queriers can contain `nil` values, which causes nip
pointer dereference when calling `Close()` on them.

The regression was introduced with PR #13288

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants