Received DATA frame for an unknown stream

1,425 views
Skip to first unread message

Mani Balasubramanian

unread,
Nov 16, 2017, 1:53:29 AM11/16/17
to grpc.io

Hi,
   I am using Java client/server. And I am seeing this error for a lot of messages.

Client :
---------
        Channel channel = ManagedChannelBuilder.forTarget(serviceName)

                .usePlaintext(true)

                .loadBalancerFactory(RoundRobinLoadBalancerFactory.getInstance())

                .build();



       LogCollectorServiceBlockingStub> collector = LogCollectorServiceGrpc.newBlockingStub(channel);

       

       collector.withDeadlineAfter(200, TimeUnit.MILLISECONDS).logEvents(inputEvent); //inputEvent is a custom protobuf message.




Server :

--------

        ServerBuilder<?> builder = ServerBuilder.forPort(port);

        builder.addService(ServerInterceptors.intercept(Arrays.asList(new CollectorEventProcessor()), interceptors));

        Server server = builder.build();

        LOGGER.info("Starting GRPC server on port {}", port);

        try {

            server.start();

        } catch (IOException e) {

            throw Throwables.propagate(e);

        }



// custom implementation extending the service impl generated from protobuf IDL.

public class CollectorEventProcessor extends LogCollectorServiceImplBase {

       public void log(BiddingEvent inputEvent, StreamObserver<Empty> responseObserver) {

            try {

            //process inputEvent.

            } catch (Exception ex) {

                responseObserver.onError(

                        new io.grpc.StatusRuntimeException(Status.INVALID_ARGUMENT.withDescription(ex.getMessage())));

                responseObserver.onCompleted();

                return;

            }

            try {

                // commit the processing of the message.

                responseObserver.onNext(Empty.getDefaultInstance());

                responseObserver.onCompleted();

            } catch (Exception ex) {

                //log exception

            }

        }

}





Protobuf service IDL:

---------------------

message LogCollectorEvent {

repeated BiddingEvent biddingEvents = 1;

}



// service definition for the log collection service

service LogCollectorService {

rpc logEvents(LogCollectorEvent) returns (google.protobuf.Empty); 

}







Messages are being sent in a batch of about 100 as part of LogCollectorEvent. Messages are being received on the server, but I am seeing a high frequency of this error as well.



2017-08-20 13:18:29,800 [WARN] [grpc-default-worker-ELG-3-11] io.grpc.netty.NettyServerHandler - Stream Error
io.netty.handler.codec.http2.Http2Exception$StreamException: Received DATA frame for an unknown stream 281813
at io.netty.handler.codec.http2.Http2Exception.streamError(Http2Exception.java:129)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.shouldIgnoreHeadersOrDataFrame(DefaultHttp2ConnectionDecoder.java:524)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onDataRead(DefaultHttp2ConnectionDecoder.java:185)
at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onDataRead(Http2InboundFrameLogger.java:48)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readDataFrame(DefaultHttp2FrameReader.java:421)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:251)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:160)
at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:116)
at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:353)
at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:413)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:745)


I have searched various forums for error of this type, but unable to find a solution. What is the reason for this Netty exception ?

-Mani

Eric Anderson

unread,
Nov 27, 2017, 4:58:58 PM11/27/17
to grpc.io
On Wednesday, November 15, 2017 at 10:53:29 PM UTC-8, Mani Balasubramanian wrote:

       collector.withDeadlineAfter(200, TimeUnit.MILLISECONDS).logEvents(inputEvent); //inputEvent is a custom protobuf message.


2017-08-20 13:18:29,800 [WARN] [grpc-default-worker-ELG-3-11] io.grpc.netty.NettyServerHandler - Stream Error
io.netty.handler.codec.http2.Http2Exception$StreamException: Received DATA frame for an unknown stream 281813

This seems the same as https://github.com/grpc/grpc-java/issues/3548 . Please follow that issue. It's likely "safe" as I am expecting it's because Netty "forgot" about stream 281813 during the cancellation due to deadline. But it does need more investigation. 
Reply all
Reply to author
Forward
0 new messages