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

Standalone: Possible OOME for large requests

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 7.1.0
    • 7.1.1, 7.2.0
    • Core, Vertx

    Description

      Currently in our VertxHttpClient we do the following:

                      // entity
                      Entity entity = request.getEntity();
                      if (!entity.isRawContentEmpty()) {
                          // If the message has no Content-Length header, enable chunked Transfer-Encoding
                          boolean hasContentLength = requestHeaders.containsKey(ContentLengthHeader.NAME);
                          vertxRequest.setChunked(!hasContentLength);
      
                          byte[] bytes;
                          try {
                              bytes = entity.getBytes();
                          } catch (IOException e) {
                              promise.handleRuntimeException(new RuntimeException(e));
                              return;
                          }
                          vertxRequest.write(Buffer.buffer(bytes));
                      }
      

      ==> we take all the request's content into a byte array to give it to Vert.x HTTP client. By doing so, if the request's content is big, then it can lead to an out-of-memory.

      We should consume the Entity through its rawContentInputStream and consume chunk-by-chunk the stream.
      As we will use some blocking APIs (Inputstream#read then we should offload that operation of bytes transfers into a worker thread, in order not to block the event-loop. But we can debate this...

      Attachments

        Issue Links

          Activity

            People

              laurent.vaills Laurent Vaills
              laurent.vaills Laurent Vaills
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: