fixup: panic: already has active child span

goroutine 114 [running]:
github.com/zrepl/zrepl/daemon/logging/trace.WithSpan(0x19d4b20, 0xc00033cf30, 0x1df10f7, 0x1b, 0x0, 0x0, 0x0)
	/private/tmp/zrepl-20200501-50335-10bkfxv/gopath/src/github.com/zrepl/zrepl/daemon/logging/trace/trace.go:252 +0x32b
github.com/zrepl/zrepl/daemon/logging/trace.WithSpanFromStackUpdateCtx(0xc000288f08, 0x0)
	/private/tmp/zrepl-20200501-50335-10bkfxv/gopath/src/github.com/zrepl/zrepl/daemon/logging/trace/trace_convenience.go:17 +0x53
github.com/zrepl/zrepl/util/semaphore.(*S).Acquire(0xc00009a038, 0x19d4b20, 0xc00033cf30, 0x0, 0x0, 0x0)
	/private/tmp/zrepl-20200501-50335-10bkfxv/gopath/src/github.com/zrepl/zrepl/util/semaphore/semaphore.go:25 +0x51
github.com/zrepl/zrepl/endpoint.ListAbstractionsStreamed.func3.1(0xc00035c950, 0xc00009a038, 0x19d4b20, 0xc00033cf30, 0xc000098440, 0xc000080400, 0x3d, 0x3d, 0xc000295300, 0xc000092c40, ...)
	/private/tmp/zrepl-20200501-50335-10bkfxv/gopath/src/github.com/zrepl/zrepl/endpoint/endpoint_zfs_abstraction.go:541 +0x77
created by github.com/zrepl/zrepl/endpoint.ListAbstractionsStreamed.func3
	/private/tmp/zrepl-20200501-50335-10bkfxv/gopath/src/github.com/zrepl/zrepl/endpoint/endpoint_zfs_abstraction.go:539 +0x18c
This commit is contained in:
Christian Schwarz 2020-05-01 22:46:24 +02:00
parent fc9dbdf449
commit 08424c521d

View File

@ -11,6 +11,7 @@ import (
"github.com/pkg/errors"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/util/envconst"
"github.com/zrepl/zrepl/util/semaphore"
"github.com/zrepl/zrepl/zfs"
@ -529,15 +530,16 @@ func ListAbstractionsStreamed(ctx context.Context, query ListZFSHoldsAndBookmark
}
sem := semaphore.New(int64(query.Concurrency))
ctx, endTask := trace.WithTask(ctx, "list-abstractions-streamed-producer")
go func() {
defer endTask()
defer close(out)
defer close(outErrs)
var wg sync.WaitGroup
defer wg.Wait()
_, add, wait := trace.WithTaskGroup(ctx, "list-abstractions-impl-fs")
defer wait()
for i := range fss {
wg.Add(1)
go func(i int) {
defer wg.Done()
add(func(ctx context.Context) {
g, err := sem.Acquire(ctx)
if err != nil {
errCb(err, fss[i], err.Error())
@ -547,7 +549,7 @@ func ListAbstractionsStreamed(ctx context.Context, query ListZFSHoldsAndBookmark
defer g.Release()
listAbstractionsImplFS(ctx, fss[i], &query, emitAbstraction, errCb)
}()
}(i)
})
}
}()