Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8186829 HTTP Client impl - Reduce implementation execution modes
  3. JDK-8191765

BodySubscriber.asInputStream()::close should be revisited.

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • None
    • core-libs

      BodySubscriber.asInputStream() returns an InputStream.
      The HttpClient selector manager thread will not exit until pending operations are all completed.

      Not reading the input stream may therefore prevent the selector manager thread from exiting, and the HttpClient from being garbage collected until the server eventually times out and closes the connection, as it will appear that some operation is still in progress.

      InputStream::close is linked up to Subscription.cancel, but whether the concrete implementation of that method takes the appropriate corrective action if not all bytes have been read should be evaluated: close the connection if HTTP/1.1, reset the stream if HTTP/2.

      Also the effect of not reading all data and not closing the stream should probably be documented in an @implNote

            dfuchs Daniel Fuchs
            dfuchs Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: