grpc / grpc/grpc-java

Improve handling of stream ID exhaustion

Aperta
#1,809 6 commenti 1 reazione 0 assegnatari Vedi su GitHub
netty performance
Lingua principale
Java
Stelle
12.1k
Fork
4k
Merge medio
2g 17h
PR unite (30g)
37

Descrizione

[HTTP/2 spec](https://tools.ietf.org/html/rfc7540#section-5.1.1) 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:
1. 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.
2. 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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.