Skip to content

Commit 13e2455

Browse files
correctly check nil stream (#8905)
Fixes: #8893 This PR changes the `[checkForHealthyStream`](https://github.com/grpc/grpc-go/blob/944f0585ca8664eb8f09635531c3c9d52d1e8bbb/internal/transport/keepalive_test.go#L815) function in keepalive_test.go to check for nil stream before closing the stream. This will make sure the error is returned and logged correctly instead of throwing a panic when the stream creation fails. RELEASE NOTES: None
1 parent 944f058 commit 13e2455

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

internal/transport/keepalive_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,11 @@ func checkForHealthyStream(client *http2Client) error {
816816
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
817817
defer cancel()
818818
stream, err := client.NewStream(ctx, &CallHdr{}, nil)
819-
stream.Close(err)
820-
return err
819+
if err != nil {
820+
return err
821+
}
822+
stream.Close(nil)
823+
return nil
821824
}
822825

823826
func pollForStreamCreationError(client *http2Client) error {

0 commit comments

Comments
 (0)