Skip to content

Definative guidance for keepalive using gRPC server side streaming #2588

Open
@Tommo56700

Description

@Tommo56700

I am hoping to get my head around server side keepalive settings in grpc-dotnet.

Scenario

Push based notifications. The client starts a streaming call which they expect to be long lived (for the duration of the program). The server can send push notifications via streaming to the client. The stream can become idle for long periods of time if there are no new notifications to be sent, but the connection should still be kept "warm".

This is running in an environment with a network firewall that will kill connections without traffic for an hour.

In this case, I have an ASP.NET 8 Server, and a Python Client.

Problem

I can't find definitive guidance on how to configure both sides for the above scenario. I am getting an error on the client after an hour of inactivity:

status = StatusCode.UNAVAILABLE
details = "Socket closed"
debug_error_string = "UNKNOWN:Error received from peer"

I have done a fair amount of extra reading:

gRPC docs highlight the importance of server and client settings being configured together. What I find somewhat confusing is that many of the keepalive configurations do not seem to be settable via the ASP.NET server e.g:

  • keepalive_time_ms
  • keepalive_permit_without_calls
  • max_pings_without_data

It seems the explanation for this is that Kestrel handles keepalive itself (which I think is enabled by default?). My confusion probably stems from my lack of understanding about Kestrel. But I would appreciate it if someone could point me in the right direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions