From 017456df63cabb523e5868cc341267d24d864ea4 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Mon, 16 Sep 2019 16:18:01 -0700 Subject: [PATCH] Wait clearing the close channel (#8250) Close channel should not be nilled before goroutines have exited. Fixes potential hang on closing. --- pkg/s3select/csv/reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/s3select/csv/reader.go b/pkg/s3select/csv/reader.go index bdf24d922..605aee9aa 100644 --- a/pkg/s3select/csv/reader.go +++ b/pkg/s3select/csv/reader.go @@ -106,8 +106,8 @@ func (r *Reader) Read(dst sql.Record) (sql.Record, error) { func (r *Reader) Close() error { if r.close != nil { close(r.close) - r.close = nil r.readerWg.Wait() + r.close = nil } r.recordsRead = len(r.current) if r.err == nil {