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

Add a means to close idle connections in HTTP/2 connection pool

    XMLWordPrintable

Details

    • b25
    • generic
    • generic

    Description

      A DESCRIPTION OF THE PROBLEM :
      This is similar to https://bugs.openjdk.org/browse/JDK-8203701, although 8203701 discuses size of a pool.
      Although often it is necessary to close idle HTTP/2 connections before server sends GOAWAY packet, because certain Cloud Load Balancers can close idle TCP connections silently.
      AWS : 350 seconds
      Azure Load Balancer : 4 minutes by default.

      If server chooses to send GOAWAY later than LB TCP idle timeout, HttpClient throws "Connection Reset by Peer" on a next attempt of connection reuse

      An example code

      public class Test {
          private static final HttpClient CLIENT = HttpClient.newBuilder().version( HttpClient.Version.HTTP_2 ).build();

          public static void main( String[] args ) throws Exception {
              final HttpRequest request = HttpRequest.newBuilder().uri( URI.create( "https://example.com/" ) ).build(); // example.com normally sends GOAWAY in 180 seconds
              System.out.println( CLIENT.send( request, HttpResponse.BodyHandlers.ofString() ).body() );
              Thread.sleep( 200 * 1000 ); // Assuming LB closes TCP connection in 120 seconds
              System.out.println( CLIENT.send( request, HttpResponse.BodyHandlers.ofString() ).body() ); // Throws Connection reset by peer
          }
      }


      Attachments

        Issue Links

          Activity

            People

              ccleary Conor Cleary
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: