[2.2.1-scala] frame.TooLongFrameException: An HTTP line is larger than 4096 bytes.

2,268 views
Skip to first unread message

Interix

unread,
Nov 20, 2013, 12:44:56 PM11/20/13
to play-fr...@googlegroups.com
Hey, can someone please help me resolve an issue, i recieve following message and yes URL is intended to be longer then 4096

org.jboss.netty.handler.codec.
frame.TooLongFrameException: An HTTP line is larger than 4096 bytes.
        at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readLine(HttpMessageDecoder.java:642) ~[netty.jar:na]
        at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:182) ~[netty.jar:na]
        at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:101) ~[netty.jar:na]
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500) ~[netty.jar:na]
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:485) ~[netty.jar:na]
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) ~[netty.jar:na]
       

Configuration for NettyServer.scala in /opt/play/framework/src/play/src/main/scala/play/core/server set to following, however altering this value still producing an error

      val maxInitialLineLength = Option(System.getProperty("http.netty.maxInitialLineLength")).map(Integer.parseInt(_)).getOrElse(4096)
      val maxHeaderSize = Option(System.getProperty("http.netty.maxHeaderSize")).map(Integer.parseInt(_)).getOrElse(8192)
      val maxChunkSize = Option(System.getProperty("http.netty.maxChunkSize")).map(Integer.parseInt(_)).getOrElse(8192)
      newPipeline.addLast("decoder", new HttpRequestDecoder(maxInitialLineLength, maxHeaderSize, maxChunkSize))
      newPipeline.addLast("encoder", new HttpResponseEncoder())
      newPipeline.addLast("decompressor", new HttpContentDecompressor())
      newPipeline.addLast("http-pipelining", new HttpPipeliningHandler())
      newPipeline.addLast("handler", defaultUpStreamHandler)
      newPipeline

Can someone please point me to the right way to address this, currently running following version: play 2.2.1 built with Scala 2.10.2 (running Java 1.6.0_27)

Thank you

Johan Andren

unread,
Nov 20, 2013, 1:30:30 PM11/20/13
to play-fr...@googlegroups.com
How do you mean altering this value still produces error, did you set it on the command line or in JAVA_OPTS when starting play?

Sergey Khutoryanskiy

unread,
Nov 20, 2013, 1:32:38 PM11/20/13
to play-fr...@googlegroups.com

The only thing I did is altered value in /opt/play/framework/src/play/src/main/scala/play/core/server/NettyServer.scala and stop/started play. Can you give me a sample of action I should take in order for me to resolve this issue.

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Johan Andren

unread,
Nov 20, 2013, 2:29:03 PM11/20/13
to play-fr...@googlegroups.com, s...@rokolabs.com
The play sources are not automagically compiled or used, just shipped along the compiled play libraries. Since the code you refer to uses a system property you could try to set that system property, for example through the environment variable JAVA_OPTS or by providing play with command line parameters (I think you could do that by -Dhttp.netty.maxInitialLineLength=8192). 

Make sure you have understood why that limit was set to 4096 though, there might be a very good reason for it and changing it without having good knowledge of netty might have unexpected consequences/bad performance/something.

Interix

unread,
Nov 21, 2013, 12:25:08 AM11/21/13
to play-fr...@googlegroups.com, s...@rokolabs.com
Thank you for a suggestion and explanation. I have edited JAVA_OPTS and issue was addressed.
Reply all
Reply to author
Forward
0 new messages