0xMiden / 0xMiden/node

Default gRPC server max connection age causes long-lived subscriptions to be closed periodically

Open
#2,273 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
104
Forks
138
Avg merge
1d 13h
Merged PRs (30d)
56

Description

### Node's components affected by this task

- [x] RPC
- [ ] Block producer
- [ ] Store
- [ ] Network transaction builder
- [ ] Remote prover
- [ ] Protobuf messages
- [ ] Testing

### What should be done?

We're configuring [max connection age](https://docs.rs/tonic/latest/tonic/transport/struct.Server.html#method.max_connection_age) for our RPC API. Since that API now includes long-lived subscriptions for block and proof subscriptions this is maybe not a good idea. The exact max age is configurable, the default is 30 minutes which is fairly low to cause observable force-reconnects for clients.

### How should it be done?

I assume that the reason for configuring a max age was making sure that connections where the client has became unreachable are timing out eventually.

Ideally we'd close _idle_ connections after a configurable timeout. However, `tonic` does not seem to have a configuration option for doing that.

HTTP/2 keep-alives can be enabled by [`http2_keepalive_interval`](https://docs.rs/tonic/latest/tonic/transport/struct.Server.html#method.http2_keepalive_interval) but since we're not on HTTP/2 exclusively that might just be insufficient.

### When is this task done?

The task is done when:

- either connection-max-age setting is gone and we have a replacement mechanism guaranteeing that connections where the client is unreachable are timing out eventually,
- or we have determined that `tonic` provides no better solution than configuring `connection_max_age`.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.