Merge pull request #13558 from gfuzz-asplos/main

fixing goroutine leaks
This commit is contained in:
Piotr Tabor 2022-01-15 16:58:19 +01:00 committed by GitHub
commit 0285f74aea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View File

@ -33,7 +33,7 @@ import (
) )
func dummyIndexWaiter(index uint64) <-chan struct{} { func dummyIndexWaiter(index uint64) <-chan struct{} {
ch := make(chan struct{}) ch := make(chan struct{}, 1)
go func() { go func() {
ch <- struct{}{} ch <- struct{}{}
}() }()

View File

@ -724,6 +724,8 @@ func TestConcurrentReadTxAndWrite(t *testing.T) {
) )
b, tmpPath := betesting.NewDefaultTmpBackend(t) b, tmpPath := betesting.NewDefaultTmpBackend(t)
s := NewStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{}) s := NewStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{})
defer b.Close()
defer s.Close()
defer os.Remove(tmpPath) defer os.Remove(tmpPath)
var wg sync.WaitGroup var wg sync.WaitGroup

View File

@ -265,7 +265,8 @@ func TestWatchFutureRev(t *testing.T) {
s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{}) s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{})
defer func() { defer func() {
s.store.Close() b.Close()
s.Close()
os.Remove(tmpPath) os.Remove(tmpPath)
}() }()

View File

@ -216,7 +216,8 @@ func TestWatchDeleteRange(t *testing.T) {
s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{}) s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{})
defer func() { defer func() {
s.store.Close() b.Close()
s.Close()
os.Remove(tmpPath) os.Remove(tmpPath)
}() }()