Skip to content

KeepAliveInterval sets an unknown gRPC option, so keepalive pings are never sent #38

Closed

Description

@maarioos123

What happens

BaseKurrentDBClient.__init__ maps KeepAliveInterval to the channel option grpc.keepalive_ms. gRPC does not know this option and ignores it. The gRPC option is grpc.keepalive_time_ms. Because of this, KeepAliveInterval and KeepAliveTimeout in the connection string have no effect, and the client sends no keepalive pings.

Steps to reproduce

  1. Connect with ?KeepAliveInterval=5000&KeepAliveTimeout=5000.
  2. Freeze KurrentDB with docker pause and start a read.
  3. Run with GRPC_TRACE=http_keepalive GRPC_VERBOSITY=DEBUG.

Result: no keepalive pings are sent, and the read waits until KurrentDB responds again.

A second detail

With grpc.keepalive_time_ms set, the pings are sent. But with grpcio 1.84, an unanswered ping fails the connection only after grpc.http2.ping_timeout_ms, which defaults to 60 s. grpc.keepalive_timeout_ms did not shorten this in my test.

With grpc.keepalive_time_ms=5000, grpc.http2.ping_timeout_ms=5000 and grpc.http2.max_pings_without_data=0, 40 reads against a frozen KurrentDB failed at 9.7 s with ServiceUnavailableError: Stream removed (ping timeout). The client read normally again after the unpause. Normal use with 5 s pings for about 95 s, with idle gaps up to 45 s, caused no too_many_pings errors.

Proposed change

  • Map KeepAliveInterval to grpc.keepalive_time_ms.
  • Also set grpc.http2.ping_timeout_ms from KeepAliveTimeout, so that an unanswered ping fails the connection in time.
  • Set grpc.http2.max_pings_without_data=0, so that pings continue while a call waits without data.

I'm opening a PR with this change.

Versions: kurrentdbclient 1.3.3, grpcio 1.84.0, KurrentDB 26.1.2, Python 3.13.

Activity

  1. added a commit that references this issue on Oct 16, 2026
    29284d0
  2. johnbywater commented on Oct 17, 2026

    @johnbywater
    Collaborator

    Thanks for the details @maarioos123 and the PR. As I mention in #39 (comment) this is fixed in https://pypi.org/project/kurrentdbclient/1.3.4/ which has been tested with all the latest Docker images, updated versions of the dependencies, and Python 3.15. Let us know if you have any further issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions