#11 Problem with chunked transmission



I may have found a problem with chunked transmissions of requests. in PJB

Whenever the size of a request exceeds RECV_SIZE (8192) the request hangs and I
have to interrupt the program, which generates the following exception in the log file:

May 19 01:57:23 JavaBridge ERROR: An exception occured: java.lang.IllegalStateException: read chunked packet length
java.lang.IllegalStateException: read chunked packet length
at php.java.bridge.http.ChunkedInputStream.readPacketLength(ChunkedInputStream.java:128)
at php.java.bridge.http.ChunkedInputStream.read(ChunkedInputStream.java:96)
at php.java.bridge.Parser.read(Parser.java:94)
at php.java.bridge.Parser.parse(Parser.java:176)
at php.java.bridge.Request.handleRequest(Request.java:383)
at php.java.bridge.Request.handleRequests(Request.java:500)
at php.java.bridge.JavaBridge.handleRequestsInternal(JavaBridge.java:140)
at php.java.bridge.JavaBridgeRunner.doPut(JavaBridgeRunner.java:171)
at php.java.bridge.http.HttpServer.service(HttpServer.java:260)
at php.java.bridge.http.HttpServer$Runner.run(HttpServer.java:185)
at php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60)

After a little bit of investigating ;-) I may have found the solution. With this patch it
works for me, but I'm not sure whether this is the case for all possible applications or
if it does have any side effects...

--- server/php/java/bridge/http/ChunkedInputStream.java.orig 2010-05-02 13:20:01.000000000 +0200
+++ server/php/java/bridge/http/ChunkedInputStream.java 2010-05-21 16:23:46.000000000 +0200
@@ -89,6 +89,8 @@
pos += remainLen;
len -= remainLen;
offset = remainLen;
+ remaining = null;
+ return remainLen;

Is this a possible solution or am I completely wrong?



  • Nobody/Anonymous

    Hi Oliver,

    yes, you're right.
    Since version the standalone back end might run into a dead

    The chunked reader must not block if there's any data in the buffer
    or if no data is requested.

    Your patch is good, except for the corner case len = 0.
    I will commit it asap.

    Thank you very much!

  • Jost Bökemeier

    Jost Bökemeier - 2010-05-22
    • assigned_to: nobody --> jost_boekemeier
    • status: open --> closed
  • Jost Bökemeier

    Jost Bökemeier - 2010-05-22

    Fixed in CVS head. Thanks again!

    > Since version

    Bug appeared in


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks