LengthFieldBasedFrameDecoder fails with TooLongFrameException
See original GitHub issueAfter 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:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@normanmaurer Working on it.
@kshchepanovskyi can you provide a reproducer ?