GRPC call failing with error "Received unexpected EOS on DATA frame from server."

Viewed 2281

I am using GRPC to connect to a service. Sometimes calls are successful, while sometimes it fails with exception Received unexpected EOS on DATA frame from server.

I am not able to find the reason to this. Following is code making call:

public class LmServiceClientImpl implements LmServiceClient {

    LMAttributeServiceGatewayGrpc.LMAttributeServiceGatewayBlockingStub lmAttributeServiceGatewayBlockingStub;

    @Autowired
    @Qualifier("lmservice")
    private ManagedChannel managedChannel;

    @PostConstruct
    public void init() {
        lmAttributeServiceGatewayBlockingStub = LMAttributeServiceGatewayGrpc.newBlockingStub(managedChannel);
    }

    @Override
    public LMAttributesApiProto.IpAttributeResponse getAttributes(
            final LMServiceProto.IpEntityRequest ipEntityRequest
    ) {
        try {
            log.info("Querying DLM service with payload {}",
                    JsonFormat.printer().print(ipEntityRequest.toBuilder()));
        } catch (final Exception e) {
            // No action required
        }
        final LMAttributesApiProto.IpAttributeResponse ipAttributeResponse =
                lmAttributeServiceGatewayBlockingStub.getAttributes(ipEntityRequest);

        try {
            log.info("Response from DLM service {}", JsonFormat.printer().print(ipAttributeResponse.toBuilder()));
        } catch (final Exception e) {
            // No action required
        }
        return ipAttributeResponse;
    }
}

The ManagedChannel is getting autowired from following class:

public class LmServiceGrpcConfig {

    @Value("${lm.server.host}")
    private String host;

    @Value("${lm.server.port}")
    private int port;

    @Bean("lmservice")
    public ManagedChannel prepareManagedChannel() {
        return NettyChannelBuilder.forAddress(host, port)
                .usePlaintext()
                .build();
    }

}

Client dependencies:

def grpcVersion = '1.26.0'
compile group: 'io.netty', name: 'netty-all', version: '4.1.44.Final'
    compile group: 'io.grpc', name: 'grpc-protobuf', version: "${grpcVersion}"
    compile group: 'io.grpc', name: 'grpc-stub', version: "${grpcVersion}"
    compile group: 'io.grpc', name: 'grpc-services', version: "${grpcVersion}"
    compile group: 'io.grpc', name: 'grpc-okhttp', version: "${grpcVersion}"
    compile 'com.google.protobuf:protobuf-java:3.5.1'
    compile 'com.google.protobuf:protobuf-java-util:3.5.1'

    compile group: "io.github.lognet", name: "grpc-spring-boot-starter", version: "3.4.1"

Server is in golang and uses google.golang.org/grpc v1.25.1

Not sure what is causing the issue. Please help. I have seen some posts on github issues regarding this, but that didn't help.

1 Answers

I believe this message means that the request timed out. Envoy is cutting the stream short by sending the message "End of Stream" (EOS).

On the server, you might also see something like this:

akka.http.scaladsl.model.http2.PeerClosedStreamException: Stream with ID [15655] was closed by peer with code NO_ERROR(0x00)

According torequest_timeout Envoy documentation:

This timeout is not compatible with streaming requests.

Related