]> Cypherpunks repositories - gostls13.git/commit
runtime: handle selects with duplicate channels in shrinkstack
authorIan Lance Taylor <iant@golang.org>
Fri, 8 Jul 2016 00:43:08 +0000 (17:43 -0700)
committerAndrew Gerrand <adg@golang.org>
Fri, 8 Jul 2016 02:05:40 +0000 (02:05 +0000)
commit84bb9e62f06dbb62279241fa0bd7a6c8846271ac
tree6529e2381816c0789f1c06a0cf2899ddf37ffacd
parente5ff529679b3adbed06d509b0fc21a76b62e89e9
runtime: handle selects with duplicate channels in shrinkstack

The shrinkstack code locks all the channels a goroutine is waiting for,
but didn't handle the case of the same channel appearing in the list
multiple times. This led to a deadlock. The channels are sorted so it's
easy to avoid locking the same channel twice.

Fixes #16286.

Change-Id: Ie514805d0532f61c942e85af5b7b8ac405e2ff65
Reviewed-on: https://go-review.googlesource.com/24815
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/chan_test.go
src/runtime/stack.go