-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
cause=io.netty.handler.codec.http2.Http2Exception: Header size exceeded max allowed size (10240) #2935
Comments
|
You can set this, but you will have to use NettyChannelBuilder. It is currently not a stable API, so you may need to change in the future as we modify it. |
@carl-mastrangelo I'm really new to grpc can you give a quick outline of how to do that ? Option on channelBuilder? |
Another question can you tell if this issue is with the outbound request or the inbound ? |
Are you connecting bigendian and littleendian systems, e.g. are you using a hyperledger on s390x? |
All on a local box. Client connecting to servers running in docker. hopefully no big/little endian issue there :) |
From that trance is it due to outbound or inbound ? |
Thanks what had me confused about that was is states "ListSize" but I'll look into it. |
Hey, I am getting a similar, but not quite the same issue. I am uses gRPC-java 1.3.0 When I build the a channel I set the max header size to be very high. originChannel = NettyChannelBuilder.forAddress(this.configuration.getHost(), this.configuration.getPort()).maxHeaderListSize(100000)
.sslContext(GrpcSslContexts.forClient().build()).build(); However, when I am building a lot of streams WARNING: Publish stream closing because failed with error: Status{code=INTERNAL, description=null, ****cause=io.netty.handler.codec.http2.Http2Exception$HeaderListSizeException: Header size exceeded max allowed size (8192)****
at io.netty.handler.codec.http2.Http2Exception.headerListSizeError(Http2Exception.java:169)
at io.netty.handler.codec.http2.Http2CodecUtil.headerListSizeExceeded(Http2CodecUtil.java:252)
at io.netty.handler.codec.http2.internal.hpack.Encoder.encodeHeadersEnforceMaxHeaderListSize(Encoder.java:128)
at io.netty.handler.codec.http2.internal.hpack.Encoder.encodeHeaders(Encoder.java:112)
at io.netty.handler.codec.http2.DefaultHttp2HeadersEncoder.encodeHeaders(DefaultHttp2HeadersEncoder.java:69)
at io.netty.handler.codec.http2.DefaultHttp2FrameWriter.writeHeadersInternal(DefaultHttp2FrameWriter.java:435)
at io.netty.handler.codec.http2.DefaultHttp2FrameWriter.writeHeaders(DefaultHttp2FrameWriter.java:200)
at io.netty.handler.codec.http2.Http2OutboundFrameLogger.writeHeaders(Http2OutboundFrameLogger.java:60)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder.writeHeaders(DefaultHttp2ConnectionEncoder.java:188)
at io.netty.handler.codec.http2.DecoratingHttp2FrameWriter.writeHeaders(DecoratingHttp2FrameWriter.java:52)
at io.netty.handler.codec.http2.StreamBufferingEncoder.writeHeaders(StreamBufferingEncoder.java:157)
at io.netty.handler.codec.http2.StreamBufferingEncoder.writeHeaders(StreamBufferingEncoder.java:141)
at io.grpc.netty.NettyClientHandler.createStream(NettyClientHandler.java:426)
at io.grpc.netty.NettyClientHandler.write(NettyClientHandler.java:240)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:739)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:731)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:817)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:724)
at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:1022)
at io.netty.channel.AbstractChannel.write(AbstractChannel.java:291)
at io.grpc.netty.WriteQueue.flush(WriteQueue.java:127)
at io.grpc.netty.WriteQueue.access$000(WriteQueue.java:47)
at io.grpc.netty.WriteQueue$1.run(WriteQueue.java:59)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:445)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
at java.lang.Thread.run(Thread.java:745)
} It seems that Is there a way for me to change the maximum header size for creation of streams, not just channels? P.s. Still a little new to this gRPC-java thing |
@cvkumar, |
@ejona86 I see. So you mean the server side is running into this error? That is interesting.... To give you some context, we are trying to update our gRPC java version from 1.0.0 to 1.3.0. But when we do some of our tests break with this error. Do you know of a reason why upgrading our version would cause this? |
Closing. Unknown why upgrading from 1.0 to 1.3 would trigger the behavior, but the limit was already in place in 1.0 and the breaking code is exceeding the maximum message size. |
I think @cvkumar was onto something here. I am also seeing this error using grpc 1.10 with netty-codec-http:4.1.17.Final It appears that Encoder has a constructor param called 'ignoreMaxHeaderListSize' that would eliminate this error. How do we set this option using [EDIT] |
I should add that my error is occurring when my client is connecting through an Envoy proxy. This error does not occur when I connect directly to the Java server. I am gathering that perhaps there is some negotiation between the client and server that establishes an agreed-upon maxHeaderSize. Is that correct or am I off track? |
There is some negotiation of SETTINGS_MAX_HEADER_LIST_SIZE, but you would need to check the SETTINGS frame to see if there are different. |
After doing a bit more research and debugging, I'm not sure how to proceed. I run a distributed Java server application with Envoy proxies fronting the servers. We have clients in Java, Python, and Go, but this particular error in occurring only in a Java client. We have configured the server application to initialize the channel with NettyChannelBuilder.maxHeaderListSize(PLENTY_LARGE). As @carl-mastrangelo suggested, I debugged the client and looked at the settings frame that is coming from the server. When I connect with my Java client directly to the java server, I see in the settings frame from the server that SETTINGS_MAX_HEADER_LIST_SIZE is set to PLENTY_LARGE. The client works fine in this case. However, when I connect through an Envoy proxy, Envoy sends no value for SETTINGS_MAX_HEADER_LIST_SIZE. The HTTP/2 spec says this about SETTINGS_MAX_HEADER_LIST_SIZE:
Netty chooses an initial default header size of 8192 bytes, but it is enforcing this limit on BOTH the sending and receiving side of the client - even when the server sends no value for SETTINGS_MAX_HEADER_LIST_SIZE. If the server has not sent any value for this setting, then the client should not place an arbitrary limit on the header size! So, how can I tell the client to stop enforcing a limit on header size when the server has not specified any limit? |
My issue is being addressed in #4284 . Thanks! |
Please answer these questions before submitting your issue.
1.2.0
java.runtime.name = OpenJDK Runtime Environment
12:22:18 java.runtime.version = 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13
12:22:18 java.specification.name = Java Platform API Specification
12:22:18 java.specification.vendor = Oracle Corporation
12:22:18 java.specification.version = 1.8
12:22:18 java.vendor = Oracle Corporation
12:22:18 java.vendor.url = http://java.oracle.com/
12:22:18 java.vendor.url.bug = http://bugreport.sun.com/bugreport/
12:22:18 java.version = 1.8.0_121
12:22:18 java.vm.info = mixed mode
12:22:18 java.vm.name = OpenJDK 64-Bit Server VM
12:22:18 java.vm.specification.name = Java Virtual Machine Specification
12:22:18 java.vm.specification.vendor = Oracle Corporation
12:22:18 java.vm.specification.version = 1.8
12:22:18 java.vm.vendor = Oracle Corporation
12:22:18 java.vm.version = 25.121-b13
12:22:18 line.separator = \
grpc async call There really isn't any special options set on the channelbuilder
except usePlaintext it does have that set to true but a the moment not sure why.
The scenario this is running on works for all systems I'v but on these vms.
Ubuntu vm 16.04.
Is there some way to increase that size.
I can't imagine that the packet size would be any different between these system .. it's running the same test. Is there any other reason this exception might happen?
The text was updated successfully, but these errors were encountered: