Open
Description
HTTP/2 spec limits the number of stream identifiers to 2^30, which means a channel must create a new transport once the limit is reached.
A couple of challenges with the current implementation:
- The exception "UNAVAILABLE: Stream IDs have been exhausted" is thrown, making the current RPC fail.
- A new transport is only created once all RPCs are complete, which is a problem for slow RPC and long lived streams, as there's no upper bound for how long a stream can live.
The implication here is that a channel can become unavailable for a unbounded amount of time. Here's a couple of possible improvements:
- Forcefully cancel active RPCs so that the transport can shutdown quickly and completely so that a new transport can be opened. This is somewhat consistent with the current behavior where RPCs fail due to Stream ID exhaustion, but is still suboptimal with the same set of problems the current implementation has with failing RPCs. Given that a client already has to deal with various error situations, this could be a good enough solution.
- Start new transport without waiting for the current transpot to shut down. This has a worst case scenario of creating a transport per long lived stream per ~1 billion requests, which is perhaps rarely enough given that a few thousands requests per second should last a few days.
See background discussion on https://groups.google.com/d/msg/grpc-io/GfeL3lse6lM/PZ-cy8qkAwAJ