Skip to content
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

Any way to get a connections' max_concurrent_streams ? #260

Closed
igorclark opened this issue Feb 2, 2021 · 11 comments
Closed

Any way to get a connections' max_concurrent_streams ? #260

igorclark opened this issue Feb 2, 2021 · 11 comments

Comments

@igorclark
Copy link

Hi!

I can see the value is referred to in gun_http2.erl, but there's no apparent way in gun:info or the like to get it out. I know a client can get the info from the connection, because curl -v shows * Connection state changed (MAX_CONCURRENT_STREAMS == 128)! on a connection to a server I'm in control of, and changing http2_max_concurrent_streams on the nginx config is reflected in that banner.

I'd love to be able to access it so I can open a separate connection if i get to the limit in a current one. No idea how to go about adding this to cowboy though. Happy to have a go with some kind of pointer, unless it's really deep in there ...

Cheers 👍

@ehamberg
Copy link
Contributor

ehamberg commented Feb 2, 2021

@igorclark You can add #{notify_settings_changed => true} to http2_opts, you'll then get a {gun_notify, ConnPid, settings_changed, Settings} message when the connection is established (and again if the settings change). The Settings map contains a max_concurrent_streams key with an integer.

@igorclark
Copy link
Author

igorclark commented Feb 2, 2021

Thanks @ehamberg, that'd be ideal! I'm getting {error,{options,{http2,{notify_settings_changed,true}}}}, is that likely because it's a 2.x feature and I'm on 1.3.3/stable?

@essen
Copy link
Member

essen commented Feb 2, 2021

Yes it's 2.0+. Highly recommend upgrading, releasing 2.0 is just a matter of time and/or gathering feedback now.

@igorclark
Copy link
Author

Ah great, thanks @essen, I'll give it a try. How far off would you say the 2.0 release is? Days, weeks maybe?

@igorclark
Copy link
Author

Whoops, accidentally closed that. Unfortunately with 2.0.0-rc.1 and no other changes I get [error] gen_statem <0.624.0> in state connected terminated with reason: {{'function not exported',{cow_http2_machine,get_remote_settings,1}},state_functions}. The app is on cowboy 2.8.0, cowlib 2.9.1 (both automatically pulled in by rebar3 just by including cowboy in deps). I guess it might be upgrade issues in my code, but I don't really have time to track this down right now so I'll work with a fixed max_concurrent_streams for now and come back to this later. Cheers 👍

@ehamberg
Copy link
Contributor

ehamberg commented Feb 3, 2021

@igorclark I think you need cowlib ≥ 2.10.1 for cow_http2_machine:get_remote_settings/1.

@igorclark
Copy link
Author

Ah, OK, I noticed the build was saying it was skipping cowlib 2.10.1 because it already had 2.9.1 - all pulled in automatically. I forced cowlib 2.10.1 in rebar.config and it worked. I guess this is something to do with the deps declaration in pre-2.0 release.

@igorclark
Copy link
Author

@igorclark I think you need cowlib ≥ 2.10.1 for cow_http2_machine:get_remote_settings/1.

Thanks @ehamberg - crossed in the post!

@essen
Copy link
Member

essen commented Feb 3, 2021

2.0 can be released after #257 is merged.

@zuiderkwast
Copy link
Contributor

Please re-open this issue.

What should happen when the max number of streams is reached? Should gun queue the requests or should the application check the value and avoid sending more requests?

@zuiderkwast
Copy link
Contributor

FYI: #280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants