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.

LengthFieldBasedFrameDecoder fails with TooLongFrameException

See original GitHub issue

After upgrading netty to 4.1.45 LengthFieldBasedFrameDecoder fails to decode frame with TooLongFrameException (some integration tests in my project started to fail). Issue is not reproducible with 4.1.44.

LengthFieldBasedFrameDecoder extends ByteToMessageDecoder so I ended up blaming https://github.com/netty/netty/pull/9891. Internally it looks like LengthFieldBasedFrameDecoder#decode is invoked two times: first time when it receives 4 bytes of header (length of payload). Second - when it receives payload. The issue is with second invocation - first 4 bytes are missing, looks like ByteBuffer is not correctly merged.

Minimal yet complete reproducer code (or URL to code)

TODO

Netty version

Issue reproduces in netty 4.1.45 and later. 4.1.44 works fine.

JVM version (e.g. java -version)

OpenJDK 11.

OS version (e.g. uname -a)

Tested on Windows 10 / Centos 7.7.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kshchepanovskyicommented, Mar 11, 2020

@normanmaurer Working on it.

1reaction
normanmaurercommented, Mar 10, 2020

@kshchepanovskyi can you provide a reproducer ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

LengthFieldBasedFrameDecoder not parsing correctly when ...
I am unit testing a netty pipeline using the frame based decoder. It looks like the framing is incorrect if I use buffer...
Read more >
How to resolve io.netty.handler.codec.TooLongFr... - JBoss.org
TooLongFrameException : Adjusted frame length exceeds 2097152: ... LengthFieldBasedFrameDecoder.fail(LengthFieldBasedFrameDecoder.java:501).
Read more >
Got an "org.jboss.netty.handler.codec.frame ...
TooLongFrameException " exception with camel-netty component ... LengthFieldBasedFrameDecoder.fail(LengthFieldBasedFrameDecoder.java:417) at ...
Read more >
How to fix : jboss.netty.handler.codec.frame ... - Google Groups
TooLongFrameException :Adjusted frame length exceeds. 1643 views ... LengthFieldBasedFrameDecoder.fail(LengthFieldBasedFrameDecoder.java:441)
Read more >
io.netty.handler.codec.TooLongFrameException.<init> java ...
LengthFieldBasedFrameDecoder.fail(...) private void fail(long frameLength) { if (frameLength > 0) { throw new TooLongFrameException( "Adjusted frame length ...
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