Panic: send on closed channel
chicknsoup opened this issue · comments
This happens randomly when using conc Pool (pool.New()).
panic: send on closed channel
goroutine 17805 [running]:
config-rd/vendor/github.com/sourcegraph/conc/pool.(*Pool).Go(0xc0005c2000, 0xc0a551e558)
E:/go/src/config-rd/vendor/github.com/sourcegraph/conc/pool/pool.go:45 +0x113
main.doGGSN(0xc0e964b688?, 0x1)
E:/go/src/config-rd/parser.go:63 +0xfd8
main.main.func3.1({{0xc031bbafc0, 0x10}, {0xc031bbafd0, 0x4}, {0xc03c3b36e0, 0x1a}, 0x1, 0x0, {0x0, 0x0}, ...})
E:/go/src/config-rd/main.go:375 +0x1c5
Hi @chicknsoup, this can happen if you call Go()
after calling Wait()
. We could likely make this error condition more clear though
Hi @chicknsoup, this can happen if you call
Go()
after callingWait()
. We could likely make this error condition more clear though
So if I'm trying to reuse the pool, it may panic? Sample pseudo code:
p:=pool.New()
for {
for i:=range y{
p.Go(handle(i))
}
p.Wait()
Sleep(xx)
}
Hi @chicknsoup, I thought about this more and I agree that pools should not panic on reuse. In particular, sync.WaitGroup
works fine on reuse, and pool
's behavior should model that. I've opened #108 to fix this issue
@camdencheek Any idea when this feature will get release?