Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Invalid
    • Affects Version/s: 4.1.3
    • Fix Version/s: None
    • Component/s: HttpClient
    • Labels:
      None
    • Environment:
      java 1.7.0_0, Windows 7 x 64, Apache 7.0.22, connections are made throug http://localhost

      Description

      Hi
      I have this servlet that generates on the fly a binary response by serializing an object. buf size is about 30 KB. I've been using this code to serve files for a long time. If I access that servlet using any web browser, the received file is OK.
      byte[] buf = respObject.stringBinSerialize();
      response.setContentLength(buf.length);
      response.setContentType("binary/octet-stream");
      response.setStatus(HttpServletResponse.SC_OK);
      OutputStream out = response.getOutputStream();
      out.write(buf);
      out.flush();

      Now I have this client code and it doesn't receive the full response.
      byte[] completo = new byte[0], temporal;
      byte[] cbuf = new byte[4096];
      int cuenta = 0, esta = 0;
      HttpParams params = new SyncBasicHttpParams();
      HttpConnectionParams.setSocketBufferSize(params, 64000);
      HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
      HttpClient httpclient = new DefaultHttpClient(params);
      try {
      HttpPost httpost = new HttpPost(targetURLinclServletName);
      HttpGet httpget = new HttpGet("http://localhost:8080/myservlet");
      HttpResponse response = httpclient.execute(httpget);
      HttpEntity entity = response.getEntity();
      if (entity != null) {
      System.out.println("ent sz " + entity.getContentLength() + " chk " + entity.isChunked() + " is rept " + entity.isRepeatable() + " str " + entity.isStreaming());
      // completo = EntityUtils.toByteArray(entity);
      System.out.println("bytearrayed " + completo.length);
      InputStream instream = entity.getContent();
      while (completo.length != entity.getContentLength() && (esta = instream.read(cbuf)) != -1) {
      if (selector.equals(RPCdefs.SELECTOR_PROYLIST) || true)

      { cuenta += esta; System.out.println("readline" + esta + " van " + cuenta); System.out.println("sz " + entity.getContentLength()); }

      temporal = new byte[completo.length + esta];
      System.arraycopy(completo, 0, temporal, 0, completo.length);
      System.arraycopy(cbuf, 0, temporal, completo.length, esta);
      completo = temporal;
      temporal = null;
      }
      }
      EntityUtils.consume(entity);
      } finally

      { httpclient.getConnectionManager().shutdown(); }

      The simplest way to receive is EntityUtils.toByteArray(entity), but it gets hung. The loop for partial copy is to know how may bytes are received. They are about 17845. The initial params were added to check if the issue was related to flow control, but with 64 KB buffers it doesn't changes anything.

        Activity

        Hide
        Mayank Nakrani added a comment -

        Actually even im facing the exact issue. Im using HttpClient for android. God know y the hell my http client is downloading exactly half the content expected from the server. The browser shows the full page. I used http sniffers to confirm the same..Please somebody try to fix it.

        Show
        Mayank Nakrani added a comment - Actually even im facing the exact issue. Im using HttpClient for android. God know y the hell my http client is downloading exactly half the content expected from the server. The browser shows the full page. I used http sniffers to confirm the same..Please somebody try to fix it.
        Hide
        Aniceto Pérez y Madrid added a comment -

        It seems related with my machine. I thought it was "clean", but it seems not.

        Show
        Aniceto Pérez y Madrid added a comment - It seems related with my machine. I thought it was "clean", but it seems not.
        Hide
        Aniceto Pérez y Madrid added a comment -

        Oleg

        I've put log messages in the server and the number of bytes written to the outputstream is correct. The problem is that for some reason thery are no fully sent.

        Thanks

        Show
        Aniceto Pérez y Madrid added a comment - Oleg I've put log messages in the server and the number of bytes written to the outputstream is correct. The problem is that for some reason thery are no fully sent. Thanks
        Hide
        Aniceto Pérez y Madrid added a comment -

        I had forgotten to put a exception stack dump in the server at the finnally clause

        ServletOutputStream out = null;
        try {

        // Get the bytes of the serialized object
        byte[] buf = respObject.stringBinSerialize();
        System.out.println("length " + buf.length);
        response.setContentType(APPLICATION_OCTET_STREAM);
        response.setContentLength(buf.length);
        response.setStatus(HttpServletResponse.SC_OK);
        out = response.getOutputStream();

        int escritos = 0;

        while (escritos < buf.length) {
        int tramo = 4096;
        if (tramo + escritos > buf.length)

        { tramo = buf.length - escritos; }

        out.write(buf, escritos, tramo);
        escritos += tramo;
        System.out.println("escritos " + tramo + " van " + escritos);
        }

        } catch (Exception ee)

        { ee.printStackTrace(); }

        finally {
        try

        { // out.flush(); response.flushBuffer(); }

        catch (Exception ee)

        { ee.printStackTrace(); }

        And when the client gets stopped, if I stop the client session I get this trace

        ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error
        at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:333)
        at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:299)
        at org.apache.catalina.connector.Response.flushBuffer(Response.java:560)
        at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:303)
        at com.innovasoftps.impl.ComRPCresponder3Impl.sendResponse(ComRPCresponder3Impl.java:105)

        This also happens when flushing the output stream intead of the response.

        What I think it's happening is that flow control is not working.

        Show
        Aniceto Pérez y Madrid added a comment - I had forgotten to put a exception stack dump in the server at the finnally clause ServletOutputStream out = null; try { // Get the bytes of the serialized object byte[] buf = respObject.stringBinSerialize(); System.out.println("length " + buf.length); response.setContentType(APPLICATION_OCTET_STREAM); response.setContentLength(buf.length); response.setStatus(HttpServletResponse.SC_OK); out = response.getOutputStream(); int escritos = 0; while (escritos < buf.length) { int tramo = 4096; if (tramo + escritos > buf.length) { tramo = buf.length - escritos; } out.write(buf, escritos, tramo); escritos += tramo; System.out.println("escritos " + tramo + " van " + escritos); } } catch (Exception ee) { ee.printStackTrace(); } finally { try { // out.flush(); response.flushBuffer(); } catch (Exception ee) { ee.printStackTrace(); } And when the client gets stopped, if I stop the client session I get this trace ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:333) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:299) at org.apache.catalina.connector.Response.flushBuffer(Response.java:560) at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:303) at com.innovasoftps.impl.ComRPCresponder3Impl.sendResponse(ComRPCresponder3Impl.java:105) This also happens when flushing the output stream intead of the response. What I think it's happening is that flow control is not working.
        Hide
        Oleg Kalnichevski added a comment -

        And what does this tell you? HttpClient uses Content-Length value specified in the response head to delineate message body. Apparently the server is sending fewer bytes that declared by the Content-Length causing HttpClient to block in a read operation while expecting more data. Your own code behaves exactly the same way.

        There can be several possibilities for such behavior. (1) The content-length value is miscalculated on the server side. Common browsers seem to have special logic that enables them to detect and recover from such situations. (2) The server fails to send enough content for some reason.

        You can see what physically gets sent across the wire by using a packet sniffer such Wireshark. If you are still convinced the problem is on the client side please create a self-contained web application I could deploy locally and a client side test case that can be used to reproduce the problem against a local servlet engine, then re-open the issue and attach both artifacts to it.

        Oleg

        Show
        Oleg Kalnichevski added a comment - And what does this tell you? HttpClient uses Content-Length value specified in the response head to delineate message body. Apparently the server is sending fewer bytes that declared by the Content-Length causing HttpClient to block in a read operation while expecting more data. Your own code behaves exactly the same way. There can be several possibilities for such behavior. (1) The content-length value is miscalculated on the server side. Common browsers seem to have special logic that enables them to detect and recover from such situations. (2) The server fails to send enough content for some reason. You can see what physically gets sent across the wire by using a packet sniffer such Wireshark. If you are still convinced the problem is on the client side please create a self-contained web application I could deploy locally and a client side test case that can be used to reproduce the problem against a local servlet engine, then re-open the issue and attach both artifacts to it. Oleg
        Hide
        Aniceto Pérez y Madrid added a comment - - edited

        This is a faulty conversation using byte[] completo = EntityUtils.toByteArray(entity); to extract content
        ----------------------------------------------------------------------------------------------------------------------------------------------------
        DEBUG [org.apache.http.impl.conn.SingleClientConnManager] Get connection for route HttpRoute[{}->http://localhost:8080]
        DEBUG [org.apache.http.impl.conn.DefaultClientConnectionOperator] Connecting to localhost:8080
        DEBUG [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: best-match
        DEBUG [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
        DEBUG [org.apache.http.impl.client.DefaultHttpClient] Attempt 1 to execute request
        DEBUG [org.apache.http.impl.conn.DefaultClientConnection] Sending request: GET /GerensDocs/BuzonProyectoRPC?ComRPC_version=2.0&Selector=crpl&ComRPC_WrappedContent=rO0ABXNyACRjb20uaW5ub3Zhc29mdHBzLmltcGwuQ29tUlBDV3JhcHBlcjLYplP02gce7wIAA0wA+CGNsaWVudElkdAASTGphdmEvbGFuZy9TdHJpbmc7TAAGb2JqZXRvdAASTGphdmEvbGFuZy9PYmpl+Y3Q7TAAJb3Bjb3VudGVydAATTGphdmEvbGFuZy9JbnRlZ2VyO3hwcHNyACdnZXJlbnNkb2NzLmNv+bXVudXBsb2FkZXIuUmVxUHJvamVjdExpc3T_QN4G5Yx0bwIABEwABWVtYWlscQB-AAFMAAVmaXJt+YXEAfgABTAACaHNxAH4AAUwABGluZm9xAH4AAXhwdAAXYXBlcmV6QGlubm92YXNvZnRwcy5jb210+ACg3MzZiOTA3YzkyYzQzODA3Yjg1OWNlNWVjM2Y1MThjZTA1MGUxZDI0dAAoNGExZGM3NTM4ODg0+OGNmZTRkZGMzZWEwNDczOTY1YmFmMmZiNDBkNXQAJ2I3ZjI4NGQ5YTRhNjdkNTNkY2RjMjdlMWM1+YWM5ODMzYjRmNDlkMHA%3D&ComRPC_AllHash_NAME=92939388e44a7aeb170a53ec2ac6299f6f745633 HTTP/1.1
        DEBUG [org.apache.http.headers] >> GET /GerensDocs/BuzonProyectoRPC?ComRPC_version=2.0&Selector=crpl&ComRPC_WrappedContent=rO0ABXNyACRjb20uaW5ub3Zhc29mdHBzLmltcGwuQ29tUlBDV3JhcHBlcjLYplP02gce7wIAA0wA+CGNsaWVudElkdAASTGphdmEvbGFuZy9TdHJpbmc7TAAGb2JqZXRvdAASTGphdmEvbGFuZy9PYmpl+Y3Q7TAAJb3Bjb3VudGVydAATTGphdmEvbGFuZy9JbnRlZ2VyO3hwcHNyACdnZXJlbnNkb2NzLmNv+bXVudXBsb2FkZXIuUmVxUHJvamVjdExpc3T_QN4G5Yx0bwIABEwABWVtYWlscQB-AAFMAAVmaXJt+YXEAfgABTAACaHNxAH4AAUwABGluZm9xAH4AAXhwdAAXYXBlcmV6QGlubm92YXNvZnRwcy5jb210+ACg3MzZiOTA3YzkyYzQzODA3Yjg1OWNlNWVjM2Y1MThjZTA1MGUxZDI0dAAoNGExZGM3NTM4ODg0+OGNmZTRkZGMzZWEwNDczOTY1YmFmMmZiNDBkNXQAJ2I3ZjI4NGQ5YTRhNjdkNTNkY2RjMjdlMWM1+YWM5ODMzYjRmNDlkMHA%3D&ComRPC_AllHash_NAME=92939388e44a7aeb170a53ec2ac6299f6f745633 HTTP/1.1
        DEBUG [org.apache.http.headers] >> Host: localhost:8080
        DEBUG [org.apache.http.headers] >> Connection: Keep-Alive
        DEBUG [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 200 OK
        DEBUG [org.apache.http.headers] << HTTP/1.1 200 OK
        DEBUG [org.apache.http.headers] << Server: Apache-Coyote/1.1
        DEBUG [org.apache.http.headers] << Content-Type: application/octet-stream;charset=UTF-8
        DEBUG [org.apache.http.headers] << Content-Length: 30828
        DEBUG [org.apache.http.headers] << Date: Wed, 29 Feb 2012 12:32:33 GMT
        DEBUG [org.apache.http.impl.client.DefaultHttpClient] Connection can be kept alive indefinitely

        and here it stops when doing completo = EntityUtils.toByteArray(entity);

        And this is a working one
        ------------------------------------
        DEBUG [org.apache.http.impl.conn.SingleClientConnManager] Get connection for route HttpRoute[{}->http://localhost:8080]
        DEBUG [org.apache.http.impl.conn.DefaultClientConnectionOperator] Connecting to localhost:8080
        DEBUG [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: best-match
        DEBUG [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
        DEBUG [org.apache.http.impl.client.DefaultHttpClient] Attempt 1 to execute request
        DEBUG [org.apache.http.impl.conn.DefaultClientConnection] Sending request: GET /GerensDocs/BuzonProyectoRPC?ComRPC_version=2.0&Selector=crping&ComRPC_WrappedContent=rO0ABXNyACRjb20uaW5ub3Zhc29mdHBzLmltcGwuQ29tUlBDV3JhcHBlcjLYplP02gce7wIAA0wA+CGNsaWVudElkdAASTGphdmEvbGFuZy9TdHJpbmc7TAAGb2JqZXRvdAASTGphdmEvbGFuZy9PYmpl+Y3Q7TAAJb3Bjb3VudGVydAATTGphdmEvbGFuZy9JbnRlZ2VyO3hwcHNyACBnZXJlbnNkb2NzLmNv+bXVudXBsb2FkZXIuUmVxUGluZ0HkEJQWJCPlAgADWgALaXNVcGxvYWRpbmdMAAVlbWFpbHEAfgAB+TAACaHNxAH4AAXhwAHB0ACg4MTU1MDJjZDQ4NjcyMmFjYWRjYWI1NTg3YzU4NGI3Y2EyNDA3MTY5+cA%3D%3D&ComRPC_AllHash_NAME=58705d496ea65c65f670eb45bbca1bbc6c64110e HTTP/1.1
        DEBUG [org.apache.http.headers] >> GET /GerensDocs/BuzonProyectoRPC?ComRPC_version=2.0&Selector=crping&ComRPC_WrappedContent=rO0ABXNyACRjb20uaW5ub3Zhc29mdHBzLmltcGwuQ29tUlBDV3JhcHBlcjLYplP02gce7wIAA0wA+CGNsaWVudElkdAASTGphdmEvbGFuZy9TdHJpbmc7TAAGb2JqZXRvdAASTGphdmEvbGFuZy9PYmpl+Y3Q7TAAJb3Bjb3VudGVydAATTGphdmEvbGFuZy9JbnRlZ2VyO3hwcHNyACBnZXJlbnNkb2NzLmNv+bXVudXBsb2FkZXIuUmVxUGluZ0HkEJQWJCPlAgADWgALaXNVcGxvYWRpbmdMAAVlbWFpbHEAfgAB+TAACaHNxAH4AAXhwAHB0ACg4MTU1MDJjZDQ4NjcyMmFjYWRjYWI1NTg3YzU4NGI3Y2EyNDA3MTY5+cA%3D%3D&ComRPC_AllHash_NAME=58705d496ea65c65f670eb45bbca1bbc6c64110e HTTP/1.1
        DEBUG [org.apache.http.headers] >> Host: localhost:8080
        DEBUG [org.apache.http.headers] >> Connection: Keep-Alive
        DEBUG [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 200 OK
        DEBUG [org.apache.http.headers] << HTTP/1.1 200 OK
        DEBUG [org.apache.http.headers] << Server: Apache-Coyote/1.1
        DEBUG [org.apache.http.headers] << Content-Type: application/octet-stream;charset=UTF-8
        DEBUG [org.apache.http.headers] << Content-Length: 360
        DEBUG [org.apache.http.headers] << Date: Wed, 29 Feb 2012 12:29:38 GMT
        DEBUG [org.apache.http.impl.client.DefaultHttpClient] Connection can be kept alive indefinitely
        DEBUG [org.apache.http.impl.conn.SingleClientConnManager] Releasing connection org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@26c5920f
        DEBUG [org.apache.http.impl.conn.DefaultClientConnection] Connection shut down

        Show
        Aniceto Pérez y Madrid added a comment - - edited This is a faulty conversation using byte[] completo = EntityUtils.toByteArray(entity); to extract content ---------------------------------------------------------------------------------------------------------------------------------------------------- DEBUG [org.apache.http.impl.conn.SingleClientConnManager] Get connection for route HttpRoute [{}->http://localhost:8080] DEBUG [org.apache.http.impl.conn.DefaultClientConnectionOperator] Connecting to localhost:8080 DEBUG [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: best-match DEBUG [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context DEBUG [org.apache.http.impl.client.DefaultHttpClient] Attempt 1 to execute request DEBUG [org.apache.http.impl.conn.DefaultClientConnection] Sending request: GET /GerensDocs/BuzonProyectoRPC?ComRPC_version=2.0&Selector=crpl&ComRPC_WrappedContent=rO0ABXNyACRjb20uaW5ub3Zhc29mdHBzLmltcGwuQ29tUlBDV3JhcHBlcjLYplP02gce7wIAA0wA+CGNsaWVudElkdAASTGphdmEvbGFuZy9TdHJpbmc7TAAGb2JqZXRvdAASTGphdmEvbGFuZy9PYmpl+Y3Q7TAAJb3Bjb3VudGVydAATTGphdmEvbGFuZy9JbnRlZ2VyO3hwcHNyACdnZXJlbnNkb2NzLmNv+bXVudXBsb2FkZXIuUmVxUHJvamVjdExpc3T_QN4G5Yx0bwIABEwABWVtYWlscQB-AAFMAAVmaXJt+YXEAfgABTAACaHNxAH4AAUwABGluZm9xAH4AAXhwdAAXYXBlcmV6QGlubm92YXNvZnRwcy5jb210+ACg3MzZiOTA3YzkyYzQzODA3Yjg1OWNlNWVjM2Y1MThjZTA1MGUxZDI0dAAoNGExZGM3NTM4ODg0+OGNmZTRkZGMzZWEwNDczOTY1YmFmMmZiNDBkNXQAJ2I3ZjI4NGQ5YTRhNjdkNTNkY2RjMjdlMWM1+YWM5ODMzYjRmNDlkMHA%3D&ComRPC_AllHash_NAME=92939388e44a7aeb170a53ec2ac6299f6f745633 HTTP/1.1 DEBUG [org.apache.http.headers] >> GET /GerensDocs/BuzonProyectoRPC?ComRPC_version=2.0&Selector=crpl&ComRPC_WrappedContent=rO0ABXNyACRjb20uaW5ub3Zhc29mdHBzLmltcGwuQ29tUlBDV3JhcHBlcjLYplP02gce7wIAA0wA+CGNsaWVudElkdAASTGphdmEvbGFuZy9TdHJpbmc7TAAGb2JqZXRvdAASTGphdmEvbGFuZy9PYmpl+Y3Q7TAAJb3Bjb3VudGVydAATTGphdmEvbGFuZy9JbnRlZ2VyO3hwcHNyACdnZXJlbnNkb2NzLmNv+bXVudXBsb2FkZXIuUmVxUHJvamVjdExpc3T_QN4G5Yx0bwIABEwABWVtYWlscQB-AAFMAAVmaXJt+YXEAfgABTAACaHNxAH4AAUwABGluZm9xAH4AAXhwdAAXYXBlcmV6QGlubm92YXNvZnRwcy5jb210+ACg3MzZiOTA3YzkyYzQzODA3Yjg1OWNlNWVjM2Y1MThjZTA1MGUxZDI0dAAoNGExZGM3NTM4ODg0+OGNmZTRkZGMzZWEwNDczOTY1YmFmMmZiNDBkNXQAJ2I3ZjI4NGQ5YTRhNjdkNTNkY2RjMjdlMWM1+YWM5ODMzYjRmNDlkMHA%3D&ComRPC_AllHash_NAME=92939388e44a7aeb170a53ec2ac6299f6f745633 HTTP/1.1 DEBUG [org.apache.http.headers] >> Host: localhost:8080 DEBUG [org.apache.http.headers] >> Connection: Keep-Alive DEBUG [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 200 OK DEBUG [org.apache.http.headers] << HTTP/1.1 200 OK DEBUG [org.apache.http.headers] << Server: Apache-Coyote/1.1 DEBUG [org.apache.http.headers] << Content-Type: application/octet-stream;charset=UTF-8 DEBUG [org.apache.http.headers] << Content-Length: 30828 DEBUG [org.apache.http.headers] << Date: Wed, 29 Feb 2012 12:32:33 GMT DEBUG [org.apache.http.impl.client.DefaultHttpClient] Connection can be kept alive indefinitely and here it stops when doing completo = EntityUtils.toByteArray(entity); And this is a working one ------------------------------------ DEBUG [org.apache.http.impl.conn.SingleClientConnManager] Get connection for route HttpRoute [{}->http://localhost:8080] DEBUG [org.apache.http.impl.conn.DefaultClientConnectionOperator] Connecting to localhost:8080 DEBUG [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: best-match DEBUG [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context DEBUG [org.apache.http.impl.client.DefaultHttpClient] Attempt 1 to execute request DEBUG [org.apache.http.impl.conn.DefaultClientConnection] Sending request: GET /GerensDocs/BuzonProyectoRPC?ComRPC_version=2.0&Selector=crping&ComRPC_WrappedContent=rO0ABXNyACRjb20uaW5ub3Zhc29mdHBzLmltcGwuQ29tUlBDV3JhcHBlcjLYplP02gce7wIAA0wA+CGNsaWVudElkdAASTGphdmEvbGFuZy9TdHJpbmc7TAAGb2JqZXRvdAASTGphdmEvbGFuZy9PYmpl+Y3Q7TAAJb3Bjb3VudGVydAATTGphdmEvbGFuZy9JbnRlZ2VyO3hwcHNyACBnZXJlbnNkb2NzLmNv+bXVudXBsb2FkZXIuUmVxUGluZ0HkEJQWJCPlAgADWgALaXNVcGxvYWRpbmdMAAVlbWFpbHEAfgAB+TAACaHNxAH4AAXhwAHB0ACg4MTU1MDJjZDQ4NjcyMmFjYWRjYWI1NTg3YzU4NGI3Y2EyNDA3MTY5+cA%3D%3D&ComRPC_AllHash_NAME=58705d496ea65c65f670eb45bbca1bbc6c64110e HTTP/1.1 DEBUG [org.apache.http.headers] >> GET /GerensDocs/BuzonProyectoRPC?ComRPC_version=2.0&Selector=crping&ComRPC_WrappedContent=rO0ABXNyACRjb20uaW5ub3Zhc29mdHBzLmltcGwuQ29tUlBDV3JhcHBlcjLYplP02gce7wIAA0wA+CGNsaWVudElkdAASTGphdmEvbGFuZy9TdHJpbmc7TAAGb2JqZXRvdAASTGphdmEvbGFuZy9PYmpl+Y3Q7TAAJb3Bjb3VudGVydAATTGphdmEvbGFuZy9JbnRlZ2VyO3hwcHNyACBnZXJlbnNkb2NzLmNv+bXVudXBsb2FkZXIuUmVxUGluZ0HkEJQWJCPlAgADWgALaXNVcGxvYWRpbmdMAAVlbWFpbHEAfgAB+TAACaHNxAH4AAXhwAHB0ACg4MTU1MDJjZDQ4NjcyMmFjYWRjYWI1NTg3YzU4NGI3Y2EyNDA3MTY5+cA%3D%3D&ComRPC_AllHash_NAME=58705d496ea65c65f670eb45bbca1bbc6c64110e HTTP/1.1 DEBUG [org.apache.http.headers] >> Host: localhost:8080 DEBUG [org.apache.http.headers] >> Connection: Keep-Alive DEBUG [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 200 OK DEBUG [org.apache.http.headers] << HTTP/1.1 200 OK DEBUG [org.apache.http.headers] << Server: Apache-Coyote/1.1 DEBUG [org.apache.http.headers] << Content-Type: application/octet-stream;charset=UTF-8 DEBUG [org.apache.http.headers] << Content-Length: 360 DEBUG [org.apache.http.headers] << Date: Wed, 29 Feb 2012 12:29:38 GMT DEBUG [org.apache.http.impl.client.DefaultHttpClient] Connection can be kept alive indefinitely DEBUG [org.apache.http.impl.conn.SingleClientConnManager] Releasing connection org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@26c5920f DEBUG [org.apache.http.impl.conn.DefaultClientConnection] Connection shut down
        Hide
        Oleg Kalnichevski added a comment -

        Unfortunately just your saying is not enough. If there is no more bytes available in the input stream the most likely explanation is that the server is simply is not sending any.

        (1) Please remove your custom code and change your code to use a standard route to consume response content such as those provided HttpUtils. Once you get it to work you can change your application code to use whatever custom routine you see fit.
        (2) Please provide a complete wire / context log of the session [1].

        If you re-open this issue without providing sufficient evidence the alleged bug, I'll close it without giving any additional explanations.

        Oleg

        [1] http://hc.apache.org/httpcomponents-client-ga/logging.html

        Show
        Oleg Kalnichevski added a comment - Unfortunately just your saying is not enough. If there is no more bytes available in the input stream the most likely explanation is that the server is simply is not sending any. (1) Please remove your custom code and change your code to use a standard route to consume response content such as those provided HttpUtils. Once you get it to work you can change your application code to use whatever custom routine you see fit. (2) Please provide a complete wire / context log of the session [1] . If you re-open this issue without providing sufficient evidence the alleged bug, I'll close it without giving any additional explanations. Oleg [1] http://hc.apache.org/httpcomponents-client-ga/logging.html
        Hide
        Aniceto Pérez y Madrid added a comment -

        The problem is not the serializing or deserializing an object. The problem is servlet is sending 30KB of binary data and httpclient only receives 17KB. With less than 14KB it works fine. But a browser receives the full content. So I say there is a bug.
        When the servlet says length 30830, I get this from the client log
        readline4096 van 4096
        sz 30830
        readline4096 van 8192
        sz 30830
        readline653 van 8845
        sz 30830
        readline4096 van 12941
        sz 30830
        readline4096 van 17037
        sz 30830
        readline808 van 17845
        sz 30830
        and here it gets stuck because no more bytes are available from the inputStream.

        Thanks

        Show
        Aniceto Pérez y Madrid added a comment - The problem is not the serializing or deserializing an object. The problem is servlet is sending 30KB of binary data and httpclient only receives 17KB. With less than 14KB it works fine. But a browser receives the full content. So I say there is a bug. When the servlet says length 30830, I get this from the client log readline4096 van 4096 sz 30830 readline4096 van 8192 sz 30830 readline653 van 8845 sz 30830 readline4096 van 12941 sz 30830 readline4096 van 17037 sz 30830 readline808 van 17845 sz 30830 and here it gets stuck because no more bytes are available from the inputStream. Thanks
        Hide
        Oleg Kalnichevski added a comment -

        I see no evidence of this being a bug in HttpClient. If you need help writing code that correctly reads and deserializes entity content please post your code to the user list, ideally with a wire / context log of the session.

        Oleg

        Show
        Oleg Kalnichevski added a comment - I see no evidence of this being a bug in HttpClient. If you need help writing code that correctly reads and deserializes entity content please post your code to the user list, ideally with a wire / context log of the session. Oleg

          People

          • Assignee:
            Unassigned
            Reporter:
            Aniceto Pérez y Madrid
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development