-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sending DefaultLastContent with trailers causes "io.netty.handler.codec.EncoderException: HttpServerCodec$HttpServerResponseEncoder must produce at least one message." #7418
Comments
Will have a Look
… Am 18.11.2017 um 23:03 schrieb Piotr Kołaczkowski ***@***.***>:
Expected behavior
Writing DefaultLastContent object with trailing headers sends an empty chunk with trailing headers.
Actual behavior
Writing DefaultLastContent with trailing headers causes EncoderException:
io.netty.handler.codec.EncoderException: HttpServerCodec$HttpServerResponseEncoder must produce at least one message.
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:98) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.CombinedChannelDuplexHandler.write(CombinedChannelDuplexHandler.java:348) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:732) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:724) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:809) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:717) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.handler.logging.LoggingHandler.write(LoggingHandler.java:254) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:732) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:795) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:807) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:788) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:824) ~[netty-all-4.0.52.Final.jar:4.0.52.Final]
at com.datastax.bdp.fs.rest.util.NettyHttpUtil$.writeAndFlush(NettyHttpUtil.scala:77) ~[dse-dsefs-common-5.0.12-cbbffcf.jar:5.0.12-cbbffcf]
at com.datastax.bdp.fs.rest.server.RestServerHandler$$anonfun$sendResponseBody$2.apply(RestServerHandler.scala:163) [dse-dsefs-common-5.0.12-cbbffcf.jar:5.0.12-cbbffcf]
at com.datastax.bdp.fs.rest.server.RestServerHandler$$anonfun$sendResponseBody$2.apply(RestServerHandler.scala:143) [dse-dsefs-common-5.0.12-cbbffcf.jar:5.0.12-cbbffcf]
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) [scala-library-2.10.6.jar:na]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:399) [netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:464) [netty-all-4.0.52.Final.jar:4.0.52.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131) [netty-all-4.0.52.Final.jar:4.0.52.Final]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
Writing DefaultLastContent with no trailing headers in the same place of code, works as expected - sends an empty last chunk and no exception is thrown.
Steps to reproduce
Setup a simple HttpServer using HttpServerCodec (without HttpMessageAggregator)
When sending a response, enable chunked transfer encoding.
writeAndFlush a DefaultLastContent object with trailers:
val lastContent = new DefaultLastHttpContent()
lastContent.trailingHeaders().add(...., ....)
context.writeAndFlush(lastContent)
Minimal yet complete reproducer code (or URL to code)
Netty version
We found the problem after upgrading to 4.0.52.Final
Error was not present in 4.0.34.Final.
JVM version (e.g. java -version)
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
OS version (e.g. uname -a)
Linux p5520 4.14.0-041400rc8-generic #201711052313 SMP Sun Nov 5 23:14:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
normanmaurer
added a commit
that referenced
this issue
Nov 19, 2017
Motivation: #7418 reported an issue with writing a LastHttpContent with trailers set. Modifications: Add unit test to ensure this issue is fixed in latest netty release. Result: Ensure code is correct.
This was referenced Nov 19, 2017
normanmaurer
added a commit
that referenced
this issue
Nov 21, 2017
Motivation: #7418 reported an issue with writing a LastHttpContent with trailers set. Modifications: Add unit test to ensure this issue is fixed in latest netty release. Result: Ensure code is correct.
Fixed by |
kiril-me
pushed a commit
to kiril-me/netty
that referenced
this issue
Feb 28, 2018
Motivation: netty#7418 reported an issue with writing a LastHttpContent with trailers set. Modifications: Add unit test to ensure this issue is fixed in latest netty release. Result: Ensure code is correct.
pulllock
pushed a commit
to pulllock/netty
that referenced
this issue
Oct 19, 2023
Motivation: 4732fab introduced a regression in HttpObjectEncoder which will lead to buffer leak and IllegalStateException when a LastHttpContent with trailers is written. Modifications: - Correctly add the buffer to the encoded list. - Add testcases Result: Fixes [netty#7418]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behavior
Writing
DefaultLastContent
object with trailing headers sends an empty chunk with trailing headers.Actual behavior
Writing
DefaultLastContent
with trailing headers causes EncoderException:Writing
DefaultLastContent
with no trailing headers in the same place of code, works as expected - sends an empty last chunk and no exception is thrown.Steps to reproduce
Minimal yet complete reproducer code (or URL to code)
Netty version
We found the problem after upgrading to 4.0.52.Final
Error was not present in 4.0.34.Final.
JVM version (e.g.
java -version
)java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
OS version (e.g.
uname -a
)Linux p5520 4.14.0-041400rc8-generic #201711052313 SMP Sun Nov 5 23:14:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: