-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #1060 maximum number of streams on the client should be capped … #1071
Conversation
…ped at 100 by default
2. Defer adding back to streamsQuota pool in CloseStream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Some minor comments.
Thanks.
transport/http2_client.go
Outdated
} | ||
var rstStream bool | ||
defer func() { | ||
if !rstStream { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments here to explain what rstStream means and our special handling for streams quota pool.
transport/http2_client.go
Outdated
@@ -1085,6 +1068,7 @@ func (t *http2Client) controller() { | |||
t.framer.writeSettings(true, i.ss...) | |||
} | |||
case *resetStream: | |||
t.streamsQuota.add(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain a little bit about the race.
transport/transport.go
Outdated
@@ -213,6 +213,9 @@ type Stream struct { | |||
// the status received from the server. | |||
statusCode codes.Code | |||
statusDesc string | |||
// rstStream is a flag that is true when a RST stream frame | |||
// is sent to the server signifying that this stream is closing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rstStream indicates whether a RSTStream needs to be sent to the server to signify that this stream is closing.
"is sent" is a bit confusing.
test/end2end_test.go
Outdated
@@ -2671,6 +2671,45 @@ func testExceedMaxStreamsLimit(t *testing.T, e env) { | |||
} | |||
} | |||
|
|||
const defaultMaxStreamsClient = 100 | |||
|
|||
func TestClientExceedMaxStreamsLimit(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about TestExceedDefaultMaxStreamsLimit
, as opposed to the previous test TestExceedMaxStreamsLimit
.
test/end2end_test.go
Outdated
"Conn.resetTransport failed to create client transport", | ||
"grpc: the connection is closing", | ||
) | ||
te.maxStream = 0 // Server allows infinite streams. The cap should be on client side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add something saying that "the server won't send the settings frame for MaxConcurrentStreams"?
…at 100 by default
fixes #1060