Skip to content

Random io.grpc.StatusRuntimeException: CANCELLED exceptions in Server-Side Streaming RPC #12107

@dennyjames

Description

@dennyjames

gRPC Version : 1.38.0
Java Version : openjdk version "11.0.27" 2025-04-15 LTS

This issue is random and is not reproducible in a test environment. Even on the environments were this is seen, issue happens randomly.

I have a server side streaming gRPC method, That returns a Iterator to the client. While looping on the iterator, below error occurs on the client side.

6066f128-75d7-42a2-af96-40c98bca2137 orgId=649529784 user=55fcc549-5f6a-42d7-85a0-2786f11a580b null
io.grpc.StatusRuntimeException: CANCELLED: Server sendMessage() failed with Error
	at io.grpc.Status.asRuntimeException(Status.java:532)
	at io.grpc.stub.ClientCalls$BlockingResponseStream.hasNext(ClientCalls.java:662)
	at com.***.data.result.BatchedSqlResultSet.next(BatchedSqlResultSet.java:89)
	at com.***.common.sql.SqlParser.getFalconResultSet(SqlParser.java:95)
	at com.***.data.manager.exporter.DataExporterImpl.exportTableVisualization(DataExporterImpl.java:1064)
	at com.***.data.manager.exporter.DataExporterImpl.exportTableVisualization(DataExporterImpl.java:927)
	at com.***.data.manager.exporter.DataExporterImpl.exportDataForVisualization(DataExporterImpl.java:640)
	at com.***.data.manager.exporter.DataExporterImpl.exportDataForVisualizations(DataExporterImpl.java:538)

On the server side, I see the below error

java.lang.IllegalStateException: call already closed
        at com.google.common.base.Preconditions.checkState(Preconditions.java:502)
        at io.grpc.internal.ServerCallImpl.closeInternal(ServerCallImpl.java:218)
        at io.grpc.internal.ServerCallImpl.close(ServerCallImpl.java:211)
        at io.grpc.stub.ServerCalls$ServerCallStreamObserverImpl.onCompleted(ServerCalls.java:395)
        at com.***.server.DataManagerGrpcImpl.executeStreamQuery(DataManagerGrpcImpl.java:177)

The fact that the error just mentions CANCELLED, without a detailed error makes it hard to understand the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions