Description
In MB-49401 our standard worker pool was used in archive.Source. The error checking is slightly wrong however. If transferVB returns an error then we will return an error. Unfortunately, due to how hofp works, there may still be goroutines alive. That means we may close the VBucketBackupReader before those goroutines are finished accessing it.
The fix is fairly simple - we can ignore the error as it will later be returned by pool.Stop, which has the added guarantee that the worker goroutines will be destroyed.
Stack trace:
github.com/couchbase/backup/storage.(*RiftDB).Close(0xc00045c0e0) |
/Users/mathall/Documents/code/cb_enterprise_src/backup/storage/rift.go:178 +0x92 |
github.com/couchbase/backup/storage.(*VBucketFileReader).Close(0xc00c5a6180) |
/Users/mathall/Documents/code/cb_enterprise_src/backup/storage/vbucket_file_reader.go:96 +0xbf |
github.com/couchbase/backup/storage.(*VBucketBackupReader).closeVBucket(0xc00b6d2a00, 0xb8) |
/Users/mathall/Documents/code/cb_enterprise_src/backup/storage/vbucket_backup_reader.go:77 +0x49 |
github.com/couchbase/backup/storage.(*VBucketBackupReader).CloseVBuckets.func1.1() |
/Users/mathall/Documents/code/cb_enterprise_src/backup/storage/vbucket_backup_reader.go:64 +0x25 |
github.com/couchbase/tools-common/hofp.(*Pool).work(0xc00c8285a0) |
/Users/mathall/.cbdepscache/gomodcache/pkg/mod/github.com/couchbase/tools-common@v0.0.0-20220401083744-ba19fc0ab6c5/hofp/pool.go:67 +0x103 |
created by github.com/couchbase/tools-common/hofp.NewPool
|
/Users/mathall/.cbdepscache/gomodcache/pkg/mod/github.com/couchbase/tools-common@v0.0.0-20220401083744-ba19fc0ab6c5/hofp/pool.go:48 +0x135 |
|