-
Notifications
You must be signed in to change notification settings - Fork 714
Closed
Description
I identified a goroutine leak with github.com/minio/minio-go/v7.(*Client).GetObject.func1 when use S3 objstore
The root cause is that the Close method is not called on the return value of bucket.Get in these two methods.
pyroscope/pkg/phlaredb/symdb/block_reader.go
Lines 254 to 269 in 81af7c6
| func (r *Reader) openIndexV12(ctx context.Context) error { | |
| f, err := r.lookupFile(IndexFileName) | |
| if err != nil { | |
| return err | |
| } | |
| o, err := r.bucket.Get(ctx, f.RelPath) | |
| if err != nil { | |
| return err | |
| } | |
| b, err := io.ReadAll(o) | |
| if err != nil { | |
| return err | |
| } | |
| r.index, err = OpenIndex(b) | |
| return err | |
| } |
pyroscope/pkg/phlaredb/block_querier.go
Lines 2044 to 2079 in 81af7c6
| func (q *singleBlockQuerier) openTSDBIndex(ctx context.Context) error { | |
| f, err := q.bucket.Get(ctx, block.IndexFilename) | |
| if err != nil { | |
| return fmt.Errorf("opening index.tsdb file: %w", err) | |
| } | |
| var buf []byte | |
| var tsdbIndexFile block.File | |
| for _, mf := range q.meta.Files { | |
| if mf.RelPath == block.IndexFilename { | |
| tsdbIndexFile = mf | |
| break | |
| } | |
| } | |
| if tsdbIndexFile.SizeBytes > 0 { | |
| // If index size is known beforehand, we can allocate | |
| // a buffer of the exact size to save some space. | |
| buf = make([]byte, tsdbIndexFile.SizeBytes) | |
| _, err = io.ReadFull(f, buf) | |
| } else { | |
| // 32KB is the default buf size of io.Copy. | |
| // It's unlikely that a tsdb index is less than that. | |
| b := bytes.NewBuffer(make([]byte, 0, 32<<10)) | |
| _, err = io.Copy(b, f) | |
| buf = b.Bytes() | |
| } | |
| if err != nil { | |
| return fmt.Errorf("reading tsdb index: %w", err) | |
| } | |
| q.index, err = index.NewReader(index.RealByteSlice(buf)) | |
| if err != nil { | |
| return fmt.Errorf("opening tsdb index: %w", err) | |
| } | |
| return nil | |
| } |
If confirmed, I can submit a CR.
kolesnikovae
Metadata
Metadata
Assignees
Labels
No labels