Skip to content

Commit

Permalink
http2: fix race in TestCanonicalHeaderCacheGrowth
Browse files Browse the repository at this point in the history
As Damien found in the 2nd patch set of CL 455736 and CL 455735,
disableGoroutineTracking is racy (but only called by benchmarks
that don't care); set the serverConn.serveG in the test instead.

Fixes golang/go#57218.

Change-Id: I5e39be3c7fbac93260a26951491863b06b39d672
Reviewed-on: https://go-review.googlesource.com/c/net/+/456523
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
  • Loading branch information
dmitshur authored and gopherbot committed Dec 10, 2022
1 parent 1e63c2f commit e1ec361
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions http2/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4547,10 +4547,11 @@ func TestServerInitialFlowControlWindow(t *testing.T) {
// TestCanonicalHeaderCacheGrowth verifies that the canonical header cache
// size is capped to a reasonable level.
func TestCanonicalHeaderCacheGrowth(t *testing.T) {
defer disableGoroutineTracking()()
for _, size := range []int{1, (1 << 20) - 10} {
base := strings.Repeat("X", size)
sc := &serverConn{}
sc := &serverConn{
serveG: newGoroutineLock(),
}
const count = 1000
for i := 0; i < count; i++ {
h := fmt.Sprintf("%v-%v", base, i)
Expand Down

0 comments on commit e1ec361

Please sign in to comment.