From 77ccaa8fb2a21b7189b887713aa0a5efbf96ccbd Mon Sep 17 00:00:00 2001 From: iamqizhao Date: Mon, 8 Feb 2016 14:27:06 -0800 Subject: [PATCH 1/2] Close ServerTransport instead of the raw connection --- server.go | 2 +- test/end2end_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index 1c42b6ef..d71c094e 100644 --- a/server.go +++ b/server.go @@ -279,7 +279,7 @@ func (s *Server) serveNewHTTP2Transport(c net.Conn, authInfo credentials.AuthInf return } if !s.addConn(st) { - c.Close() + st.Close() return } s.serveStreams(st) diff --git a/test/end2end_test.go b/test/end2end_test.go index f1c7b426..9461cd6e 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -1354,7 +1354,7 @@ func interestingGoroutines() (gs []string) { return } -var failOnLeaks = flag.Bool("fail_on_leaks", false, "Fail tests if goroutines leak.") +var failOnLeaks = flag.Bool("fail_on_leaks", true, "Fail tests if goroutines leak.") // leakCheck snapshots the currently-running goroutines and returns a // function to be run at the end of tests to see whether any From 6079240b2c4166e999b5374a13ca17dd19052609 Mon Sep 17 00:00:00 2001 From: iamqizhao Date: Mon, 8 Feb 2016 14:50:27 -0800 Subject: [PATCH 2/2] remove fail_on_leak flag --- test/end2end_test.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/end2end_test.go b/test/end2end_test.go index 9461cd6e..ff04c27c 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -1354,8 +1354,6 @@ func interestingGoroutines() (gs []string) { return } -var failOnLeaks = flag.Bool("fail_on_leaks", true, "Fail tests if goroutines leak.") - // leakCheck snapshots the currently-running goroutines and returns a // function to be run at the end of tests to see whether any // goroutines leaked. @@ -1364,10 +1362,6 @@ func leakCheck(t testing.TB) func() { for _, g := range interestingGoroutines() { orig[g] = true } - leakf := t.Logf - if *failOnLeaks { - leakf = t.Errorf - } return func() { // Loop, waiting for goroutines to shut down. // Wait up to 5 seconds, but finish as quickly as possible. @@ -1387,7 +1381,7 @@ func leakCheck(t testing.TB) func() { continue } for _, g := range leaked { - leakf("Leaked goroutine: %v", g) + t.Errorf("Leaked goroutine: %v", g) } return }