Skip to content

Fix handling of SETTINGS_MAX_CONCURRENT_STREAMS.#1184

Merged
tatsuhiro-t merged 1 commit intonghttp2:masterfrom
PiotrSikora:max_streams
Jun 5, 2018
Merged

Fix handling of SETTINGS_MAX_CONCURRENT_STREAMS.#1184
tatsuhiro-t merged 1 commit intonghttp2:masterfrom
PiotrSikora:max_streams

Conversation

@PiotrSikora
Copy link
Copy Markdown
Contributor

The maximum number of outgoing concurrent streams is initially
limited to 100 to avoid issues when the local endpoint submits
lots of requests before receiving initial SETTINGS frame from
the remote endpoint, since sending them at once to the remote
endpoint could lead to rejection of some of the requests.

This initial limit is overwritten with the value advertised in
SETTINGS_MAX_CONCURRENT_STREAMS setting by the remote endpoint,
but previously, it wasn't lifted if the remote endpoint didn't
advertise that setting (implying no limits), in which case the
limit of 100 was retained, even though it was never advertised
by the remote endpoint.

The maximum number of outgoing concurrent streams is initially
limited to 100 to avoid issues when the local endpoint submits
lots of requests before receiving initial SETTINGS frame from
the remote endpoint, since sending them at once to the remote
endpoint could lead to rejection of some of the requests.

This initial limit is overwritten with the value advertised in
SETTINGS_MAX_CONCURRENT_STREAMS setting by the remote endpoint,
but previously, it wasn't lifted if the remote endpoint didn't
advertise that setting (implying no limits), in which case the
limit of 100 was retained, even though it was never advertised
by the remote endpoint.

Signed-off-by: Piotr Sikora <[email protected]>
Comment thread lib/nghttp2_session.c
session->remote_settings.max_concurrent_streams =
NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS;
session->remote_settings_received = 1;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering setting max_concurrent_streams to max somewhere near

might make the PR simpler because we don't have to add the new field to nghttp2_session.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion doesn't work when we see the some part of SETTINGS and before calling nghttp2_session_send. I think your original PR looks good to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that removing initial limit in NGHTTP2_IB_READ_FIRST_SETTINGS could open the floodgates in case of partial read of the SETTINGS frame from a peer that advertises SETTINGS_MAX_CONCURRENT_STREAMS.

Thanks for investigating!

@tatsuhiro-t tatsuhiro-t merged commit 159c5e4 into nghttp2:master Jun 5, 2018
@tatsuhiro-t
Copy link
Copy Markdown
Member

Thank you for PR. Merged now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants