0xMiden / 0xMiden/node

Document handling idle gRPC client connections

Offen
#2,366 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
documentation rpc
Vorherrschende Sprache
Rust
Sterne
104
Forks
138
Ø Merge
1 T. 13 Std.
Gemergte PRs (30 T.)
56

Beschreibung

gRPC uses `http2` connections to multiplex all client requests onto a single connection. It assumes that a client will connect, do a bunch of work, and then disconnect.

This is fine but leaves an attack vector where clients simple leave the connection idle, consuming a connection permanently without doing any work.

We currently "solve" this by auto-disconnecting every connection after 30 minutes. This is fine for general request/response connections since these shouldn't have long lived connections.

The problem with this is that we now have "external" connections for block sync streams. The 30minute disconnect has bitten us already on several occasions, though perhaps this a good thing to harden ourselves against these unexpected failure modes.

Context aside, I would like to investigate what we can do to truly prune _idle_ connections, and not just all connections after 30 minutes.

https://github.com/grpc/grpc-rust/issues/258 sort of sounds like this is an automatic thing? However it also sounds like it keeps connections alive if clients send `keep_alive` pings. Ideally we would only keep it if the client actively sends requests.

-- edit --

I have since discovered [MAX_CONNECTION_IDLE](https://grpc.io/docs/guides/keepalive/#keepalive-configuration-specification) which is exactly what we want, but is not supported by `tonic`.

afaict we can't do this without patching `tonic`.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

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