node-http2 icon indicating copy to clipboard operation
node-http2 copied to clipboard

Client does not respect Max Streams settings from server

Open timmckenzie opened this issue 9 years ago • 2 comments

Reproduction

  • New Connection is created
  • Server sends setting frame with Max Streams of 10
  • node-http2.request() is called 11 times in a loop

Result

  • Server responds to the first 10 requests with normal headers + data
  • Server responses to the 11th request with RST_STEAM
  • node-http2 does not emit an error because the RST_STEAM

I think that there should be two fixes.

First, node-http2 should respect the max stream setting. I am thinking some internal queue with pending requests. If the number of active streams is greater than MAX stream, push next requests to the pending queue. When stream finishes, pull next request off of queue.

Second, node-http2 should raise an error to the module's user if a stream is closed with anything except a except a normal stream completion. This would include RST_STEAM, various errors, and TCP errors.

I have a packet capture too if anyone is interested.
I will see if I have time to work on this issue.

timmckenzie avatar Sep 16 '15 19:09 timmckenzie

On second though, we should be able to give the H2 client a priority tree. This could help it emulate how a browser would request resources. I suppose this would be a different bug.

timmckenzie avatar Sep 17 '15 17:09 timmckenzie

Indeed, there are 2 bugs here, so let's split them out into 2 issues. We'll keep this one for the base issue of not respecting SETTINGS_MAX_CONCURRENT_STREAMS. I'll open another to send an event on RST_STREAM.

nwgh avatar Jan 08 '16 22:01 nwgh