Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-16229

Automation Client must fully consume and close HTTP responses

    XMLWordPrintable

    Details

      Description

      This can lead to serious issues.

      When a first response from the server contains additional unexpected elements, the client might not consume it entirely.

      As a side effect, automation client will be unable to read a new response from the server because it is desynchronized.

      Typical stacktrace for the issue is:

      Caused by: java.net.SocketTimeoutException: Read timed out
      	at java.net.SocketInputStream.socketRead0(Native Method)
      	at java.net.SocketInputStream.read(SocketInputStream.java:152)
      	at java.net.SocketInputStream.read(SocketInputStream.java:122)
      	at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:166)
      	at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:90)
      	at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:281)
      	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:92)
      	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)
      	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
      	at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
      	at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
      	at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
      	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
      	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
      	at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:716)
      	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:521)
      	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
      	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
      	at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.executeRequestWithTimeout(HttpConnector.java:173)
      	at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:131)
      	at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:118)
      	... 114 more
      

      Another symptom is that because connections are not closed, they are not released to the pool and the pool may become full, therefore timeout after a while.

      java.lang.RuntimeException: Cannot execute {Authorization=Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y, Content-Type=application/json+nxrequest, Accept=application/json+nxentity, */*}
      	at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:121)
      	at org.nuxeo.ecm.automation.client.jaxrs.spi.ConnectorHandler.execute(ConnectorHandler.java:30)
      	at org.nuxeo.ecm.automation.client.jaxrs.spi.DefaultSession.execute(DefaultSession.java:112)
      	at org.nuxeo.ecm.automation.client.jaxrs.spi.DefaultOperationRequest.execute(DefaultOperationRequest.java:163)
      	at org.nuxeo.drive.operations.TestIntegrationTestOperations.testIntegrationTestsSetupAndTearDown(TestIntegrationTestOperations.java:235)
      	...
      Caused by: org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool
      	at org.apache.http.impl.conn.PoolingClientConnectionManager.leaseConnection(PoolingClientConnectionManager.java:226)
      	at org.apache.http.impl.conn.PoolingClientConnectionManager$1.getConnection(PoolingClientConnectionManager.java:195)
      	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:423)
      	at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
      	at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.executeRequestWithTimeout(HttpConnector.java:169)
      	at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:129)
      	at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:119)
      	... 41 more
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: