Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8161157

HTTP/2, there is no way to process PUT request with no body received. Either memory leak or client hang up.

XMLWordPrintable

      Issue 1 - Inconsistency between Java doc and actual HttpClient behavior.
      HttpResponse java-doc says:
      " The body or bodyAsync which retrieve any response body must be called to ensure that the TCP connection can be re-used subsequently, and any response trailers accessed, if they exist, unless it is known that no response body was received."
      Particularly for HTTP/2 implementation, if "body" or "bodyAsync" invocation is omitted (even if it is knows that no response) - it causes memory leak, because of Stream will be never deleted.

      Issue 2: attempt to invoke "body" causes client blocking.
      In case of HTTP1.1 protocol "HttpResponse.body(HttpResponse.asByteArray())" provides proper result (empty array).
      In case of HTTP/2 protocol client blocks on "Stream.receiveData" invocation waiting DataFrame.

      Processing PUT requests with no returned data HTTP/2 server may not send DataFrame at all. In such case HTTP/2 server sends returned HeadersFrame with END_STREAM flag. HttpClient doesn't have code to process such behavior.

            michaelm Michael McMahon
            skuksenko Sergey Kuksenko
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: