Skip to content

Unexpected GO_AWAY with bi-directional keep-alive #12417

@mopfattn

Description

@mopfattn

What version of gRPC-Java are you using?

1.76.0

What is your environment?

macOS with JDK 17, 21, Android 15

What did you expect to see?

Keep-alive pings are successfully exchanged

What did you see instead?

Server responds with a GO_AWAY

Steps to reproduce the bug

A sample project to reproduce this issue is available at https://github.com/mopfattn/grpc-keep-alive-go-away.

To reproduce this issue the following setup is used:

  • both gRPC server and client do keep-alive pings (without calls) each second
  • the server permits pings at an interval of 500 ms
  • run the server and client and wait
  • after some time the server response with GO_AWAY

To my understanding this ping method is invoked for incoming ping requests AND ping responses:

if (!keepAliveEnforcer.pingAcceptable()) {

In both cases keepAliveEnforcer.pingAcceptable is invoked, which then results in the GO_AWAY error.

The pingAcceptable method should probably only called, when the ping is initiated by the client (ack=false), and not if the ping is a response (ack=true) to a ping issues by the server.

Server output:

2025-10-15 05:53:58.953 [io.grpc.okhttp.OkHttpClientTransport] OUTBOUND PING: ack=false bytes=57005
2025-10-15 05:53:58.956 [io.grpc.okhttp.OkHttpServerTransport] INBOUND PING: ack=true bytes=57005
2025-10-15 05:54:08.957 [io.grpc.okhttp.OkHttpClientTransport] OUTBOUND PING: ack=false bytes=57005
2025-10-15 05:54:08.958 [io.grpc.okhttp.OkHttpServerTransport] INBOUND PING: ack=false bytes=5241911198473060747
2025-10-15 05:54:08.958 [io.grpc.okhttp.OkHttpClientTransport] OUTBOUND PING: ack=true bytes=5241911198473060747
2025-10-15 05:54:08.961 [io.grpc.okhttp.OkHttpClientTransport] OUTBOUND GO_AWAY: lastStreamId=3 errorCode=ENHANCE_YOUR_CALM length=14 bytes=746f6f5f6d616e795f70696e6773

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions