question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Exception when Cosmos DB HTTP response header is larger than 8192 bytes

See original GitHub issue

Describe the bug When the continuation token in the header of the HTTP response from the Cosmos DB is larger than 8192 bytes, the netty that is used by the SDK throws an exception. It seems that this was already fixed for SDK versions ❤️.0 but the changes were not ported to the SDK 3.x: https://github.com/Azure/azure-cosmosdb-java/issues/24

Exception or Stack Trace

io.netty.handler.codec.TooLongFrameException: HTTP header is larger than 8192 bytes.
	at io.netty.handler.codec.http.HttpObjectDecoder$HeaderParser.newException(HttpObjectDecoder.java:829)
	at io.netty.handler.codec.http.HttpObjectDecoder$HeaderParser.process(HttpObjectDecoder.java:821)
	at io.netty.buffer.AbstractByteBuf.forEachByteAsc0(AbstractByteBuf.java:1306)
	at io.netty.buffer.AbstractByteBuf.forEachByte(AbstractByteBuf.java:1286)
	at io.netty.handler.codec.http.HttpObjectDecoder$HeaderParser.parse(HttpObjectDecoder.java:793)
	at io.netty.handler.codec.http.HttpObjectDecoder.readHeaders(HttpObjectDecoder.java:592)
	at io.netty.handler.codec.http.HttpObjectDecoder.decode(HttpObjectDecoder.java:218)
	at io.netty.handler.codec.http.HttpClientCodec$Decoder.decode(HttpClientCodec.java:202)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:505)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:444)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:283)
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)
	at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1224)
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1271)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:505)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:444)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:283)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1421)
	... 12 frames truncated

To Reproduce To reproduce this, you have to make a request that will lead to a large continuation token. I don’t know about the internals of the Cosmos DB, but since the state is mapped into the continuation token and larger databases lead to larger states, a large database may be the prerequisite to reproduce this issue. We experience this issue only with multi-partition queries.

Expected behavior The accepted size of HTTP request/response headers should always be larger than the maximum that can potentially created by the Cosmos DB, whatever this size is. Maybe 32768 bytes as used in the linked issue are sufficient, maybe this is still not enough.

Setup

  • OS: Linux Arch with kernel 5.3.7, JRE 11.0.5
  • IDE : IntelliJ
  • Java SDK: version 3.2.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:28 (16 by maintainers)

github_iconTop GitHub Comments

9reactions
apescionecommented, Nov 7, 2019

I’m using Spring Data Cosmos latest (at the moment 2.1.8) and I have the same issue. This version of Spring data uses SDK 3.1.0. Could do you provide also hot fix on this version? When do you think of resolving that? Thank you

0reactions
kushagraThaparcommented, Jan 8, 2020

This issue has been fixed on all SDK versions. Closing it now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot a "Request header too large" message or 400 ...
The "Request header too large" message is thrown with an HTTP error code 400. This error occurs if the size of the request...
Read more >
Trying to understand why we are getting this error HTTP ...
handler.codec.frame.TooLongFrameException: HTTP header is larger than 8192 bytes. at org.jboss.netty.handler.codec.http.HttpMessageDecoder.
Read more >
HTTP Request Connector - MuleSoft Documentation
By default, the Grizzly libraries used by the HTTP connector limit the HTTP request header section size (request line + headers) to below...
Read more >
Stardog Platform Release Notes
Better error messages for virtual import when arguments are incorrect ... VG query fails when literals of length greater than 2048 are pushed...
Read more >
Azure Cosmos DB 4xx Status Codes - Blue Matador
HTTP 400 (Bad Request) ... A Bad Request typically means that the request body is malformed. Cosmos DB uses JSON, SQL, or JavaScript...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found