Skip to content

Commit e1ec361

Browse files
dmitshurgopherbot
authored andcommitted
http2: fix race in TestCanonicalHeaderCacheGrowth
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 <[email protected]> Reviewed-by: Damien Neil <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 1e63c2f commit e1ec361

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

http2/server_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4547,10 +4547,11 @@ func TestServerInitialFlowControlWindow(t *testing.T) {
45474547
// TestCanonicalHeaderCacheGrowth verifies that the canonical header cache
45484548
// size is capped to a reasonable level.
45494549
func TestCanonicalHeaderCacheGrowth(t *testing.T) {
4550-
defer disableGoroutineTracking()()
45514550
for _, size := range []int{1, (1 << 20) - 10} {
45524551
base := strings.Repeat("X", size)
4553-
sc := &serverConn{}
4552+
sc := &serverConn{
4553+
serveG: newGoroutineLock(),
4554+
}
45544555
const count = 1000
45554556
for i := 0; i < count; i++ {
45564557
h := fmt.Sprintf("%v-%v", base, i)

0 commit comments

Comments
 (0)