Uploaded image for project: 'Identity Gateway'
  1. Identity Gateway
  2. OPENIG-5219

Vert.x HTTP Client does not replicate current CHF behaviour when request fails and headers have been received

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 7.0.0, 7.0.1
    • Fix Version/s: 7.0.2, 7.1.0
    • Component/s: CHF, Vertx
    • Environment:
      IG Standalone
    • Story Points:
      2

      Description

      Differences seen between IG WAR and Standalone versions when downstream response does fails due to an exception but the headers have been received so there is a response that can be returned.
       
      In IG 6+ WAR:

      <--- (response) id:876abade-5994-4517-9ccc-8ae822dd1900-16 ---HTTP/1.1 201 Created
      content-encoding: gzip
      Content-Type: application/json
      Date: Tue, 22 Dec 2020 19:39:15 GMT
      Server: Finch[I/O dispatcher 25] ERROR o.f.h.servlet.HttpFrameworkServlet - Failed to write response - rootId:876abade-5994-4517-9ccc-8ae822dd1900-15
      org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected
      	at org.apache.http.impl.nio.codecs.ChunkDecoder.readChunkHead(ChunkDecoder.java:138)
      Wrapped by: java.io.IOException: Stream is in a failed state
      	at org.forgerock.http.io.FailableInputStream.checkFailedState(FailableInputStream.java:90)
      

      In IG 7+ standalone , for the exact same request/config:

      <--- (response) id:d0c61c54-b03f-473e-94f3-cf4ca400944d-16 ---HTTP/1.1 502 Bad Gateway[vert.x-eventloop-thread-9] WARN  o.f.o.f.LogAttachedExceptionFilter - Response [Status: 502 Bad Gateway] to `
      [http://localhost:31337/empty]
      ` carries an exception [txId:d0c61c54-b03f-473e-94f3-cf4ca400944d-16]
      io.vertx.core.VertxException: Connection was closed
      

      The difference comes down to an extra check being carried out in org.forgerock.http.apache.async.AsyncResponseHttpClient.EntityCompletionPromiseResponseConsumer#failed

                  if (response != null) {
                      // The response's metadata have been received
                      // Complete the promise with what we've received so far,
                      // but any attempt to read the stream will result in a failure
                      input.setFailed(e);
                      promise.handleResult(response);
                  }
      

      The org.forgerock.http.vertx.client.VertxHttpClient#failPromise is likely where we would need to apply similar logic.

        Attachments

          Activity

            People

            Assignee:
            markdr Mark de Reeper
            Reporter:
            markdr Mark de Reeper
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: