Skip to content

Commit

Permalink
http2: connection still open even if stream is properly closed
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverpool committed Dec 16, 2024
1 parent 23e98f9 commit f0cce79
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions connect_ext_close_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import (

func TestClientStream_CancelContext(t *testing.T) {
t.Run("HTTP2 disabled", func(t *testing.T) {
t.Parallel()
testClientStream_CancelContext(t, false)
})
t.Run("HTTP2 enabled", func(t *testing.T) {
t.Parallel()
testClientStream_CancelContext(t, true)
})
}
Expand Down Expand Up @@ -59,8 +61,8 @@ func testClientStream_CancelContext(t *testing.T, enableHTTP2 bool) {

closed := make(chan struct{})
go func() {
t.Log("will close stream")
t.Log("stream closed:", stream.Close()) // usually something like "read tcp 127.0.0.1:XXX->127.0.0.1:XXX: use of closed network connection"
// close stream
assert.Nil(t, stream.Close())
close(closed)
}()

Expand All @@ -79,8 +81,8 @@ func testClientStream_CancelContext(t *testing.T, enableHTTP2 bool) {
t.Error("stream was not done receiving within 1s")
}

// The connection appears to not be properly closed:
// The following line takes 5 seconds and outputs:
// The connection appears to not be properly closed with http2_enabled:
// The following line takes 10 seconds and outputs:
// httptest.Server blocked in Close after 5 seconds, waiting for connections:
// *tls.Conn 0x0000 127.0.0.1:**** in state active
startClosing := time.Now()
Expand Down

0 comments on commit f0cce79

Please sign in to comment.