Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] HttpGenerator sometimes abandons chunked mode and returns a malformed chunk (without length & new line characters)

Bartek,

Greg has updated https://bugs.eclipse.org/bugs/show_bug.cgi?id=367608.
Until jetty-9 comes out, I believe your best option is to do the
double-dispatch pattern.

cheers
Jan

On 9 August 2012 19:15, Bartosz Kowalewski <kowalewski.bartosz@xxxxxxxxx> wrote:
> Hi,
>
> In our app we're using Jetty server v. 8.1.5.v20120716 and deploying a
> Servlet 3.0 API compliant code onto it. From time to time (extremely
> rarely) the server generates a malformed HTTP response. One of the
> chunks created by HttpGenerator lacks length and line characters.
> We're only able to reproduce this behavior in long running tests of
> our app. We haven't yet succeeded in creating a test case that would
> show this behavior.
>
> I've looked at past tickets and JIRAs and found:
> http://jira.codehaus.org/browse/JETTY-586
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=363757
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=367608
>
> 367608 is the most interesting one! We're using the pattern that is
> mentioned there and is/was said not to be recommended:
> dispatch
>    {
>       suspend
>       spawn
>       {
>          write
>          complete
>       }
>    }
>
> At the same time, we're using the recommended pattern:
> dispatch
>    {
>       suspend
>       spawn
>       {
>          resume
>       }
>    }
>    dispatch
>    {
>       write
>    }
> in a completely different scenario (CXF services deployed using CXF
> servlet onto Jetty server v. 8.1.5.v20120716). Looked at CXF sources
> and indeed it uses the recommended pattern. The same long running
> tests are run against this CXF-based scenario. Issues have NEVER been
> observed. HttpGenerator was always behaving well.
>
> Is the former pattern still discouraged? Any clues how to get rid of
> these issues (other than switching to the latter pattern :-))?
>
> Below is a sample response returned by the server and an exception
> that this response generates on the client side.
>
> Thanks!
>   Bartek
> ----------------------------------------------------------------------------------------------------
>
> Response returned by the server:
>
> *** part #1
> -------------------------
> HTTP/1.1 400 Bad Request
> Content-Type: text/xml;charset=UTF-8
> Transfer-Encoding: chunked
> Server: Jetty(8.1.5.v20120716)
>
> 26
> <?xml version="1.0" encoding="UTF-8"?>
>
> -------------------------
>
> *** part #2 - the malformed one
>
> -------------------------
> <error xmlns="http://blaah.com/gw";><tid>1f7ff12c-0d24-4de4-b2d0-bc7e940ce2b6</tid><message><![CDATA[Unable
> to identify Blaah customer name. Please
> -------------------------
>
> *** part #3
>
> -------------------------
>
> 38
>  use the Blaah-Customer HTTP header]]></message></error>
> -------------------------
>
> *** part #4
>
> -------------------------
> 0
>
>
> -------------------------
>
>
> HTTP parser on the client side:
>
> HttpExchange - EXCEPTION
> ContentExchange@3d3473=POST//localhost:7785/unknown/notReally#CONTENT(40ms)->EXCEPTED(0ms)sent=88ms
> java.io.IOException: bad chunk char: 60
>         at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:905)
> ~[jetty-http-8.1.5.v20120716.jar:8.1.5.v20120716]
>         at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
> ~[jetty-http-8.1.5.v20120716.jar:8.1.5.v20120716]
>         at org.eclipse.jetty.client.AsyncHttpConnection.handle(AsyncHttpConnection.java:126)
> ~[jetty-client-8.1.5.v20120716.jar:8.1.5.v20120716]
>         at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:622)
> [jetty-io-8.1.5.v20120716.jar:8.1.5.v20120716]
>         at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
> [jetty-io-8.1.5.v20120716.jar:8.1.5.v20120716]
>         at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
> [jetty-util-8.1.5.v20120716.jar:8.1.5.v20120716]
>         at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
> [jetty-util-8.1.5.v20120716.jar:8.1.5.v20120716]
>         at java.lang.Thread.run(Thread.java:722) [na:1.7.0_05]
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users



-- 
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com – Developer advice, services and support
from the Jetty & CometD experts.


Back to the top