On Thu, Jan 17, 2019 at 9:35 AM Fei Ding <fding...@gmail.com> wrote: > map[string]chan int > I can understand that the map forbids concurrent read/write, but in my case, it actually forbid concurrent r/w to the channel, which is the basic operation. > > The panic is something like: > > goroutine 1661 [running]: > runtime.throw(0x59de0d, 0x21) > /usr/local/go/src/runtime/panic.go:619 +0x81 fp=0xc420045ed8 sp=0xc420045eb8 pc=0x42a501 > runtime.mapaccess1_faststr(0x564e40, 0xc42008aba0, 0xc4200ceba0, 0x10, 0xc4200a2f48) > /usr/local/go/src/runtime/hashmap_fast.go:181 +0x421 fp=0xc420045f48 sp=0xc420045ed8 pc=0x40be31
The panic is not caused by 'concurrent r/w to the channel', but by concurrently reading and writing a map. Please post somewhere a minimal, self contained reproducer, for example on http://play.golang.org. Someone may help you to find/fix the problem. Note that the playground probably runs in a single thread so the reproducer may not actually reproduce the panic within the playground, but that's not a problem as long as it can reproduce the panic on a local machine. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.