grpc / grpc/grpc-java

Improve handling of stream ID exhaustion

Offen
#1,809 6 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
netty performance
Vorherrschende Sprache
Java
Sterne
12.1k
Forks
4k
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
37

Beschreibung

[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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

No implementation file, test, or entry point is named. Start by locating the Java transport handling for HTTP/2 stream ID exhaustion, then resolve which proposed transport-lifecycle approach is intended; done means avoiding an unbounded channel outage without leaving the current RPC behavior unspecified.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
backend-api-design, networking
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.