Skip to content

Commit

Permalink
Merge pull request #70509 from cockroachdb/blathers/backport-release-…
Browse files Browse the repository at this point in the history
…21.2-70467

release-21.2: colexecop: harden CloseAndLogOnErr against panics
  • Loading branch information
yuzefovich authored Sep 21, 2021
2 parents ae94941 + 62cffb9 commit db7de99
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/sql/colexecop/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,15 @@ type Closers []Closer
// Note: this method should *only* be used when returning an error doesn't make
// sense.
func (c Closers) CloseAndLogOnErr(ctx context.Context, prefix string) {
prefix += ":"
for _, closer := range c {
if err := closer.Close(); err != nil && log.V(1) {
log.Infof(ctx, "%s error closing Closer: %v", prefix, err)
if err := colexecerror.CatchVectorizedRuntimeError(func() {
prefix += ":"
for _, closer := range c {
if err := closer.Close(); err != nil && log.V(1) {
log.Infof(ctx, "%s error closing Closer: %v", prefix, err)
}
}
}); err != nil && log.V(1) {
log.Infof(ctx, "%s runtime error closing the closers: %v", prefix, err)
}
}

Expand Down

0 comments on commit db7de99

Please sign in to comment.