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

Investigate timeout handling for HTTP requests sent through a proxy

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 14.0.2
    • core-libs
    • None

      It has been observed that in the presence of a network failure/outage, some HTTP requests appear to block (in the ForkJoin common pool) indefinitely.

      The requests are: 1) GET, 2) secure HTTPS, 3) HTTP/1.1, 4) using a proxy, 5) have an explicit request timeout set, and 6) the client has a connect timeout set.

      The HTTP Client in question is: 1) long running, for several hours (may have entries in its keep-alive cache, and 2) is shared across multiple (two or three) threads.

      Environment: running with system properties that set the proxy: http.proxyHost, http.proxyPort.

      Client created like:
        private final HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(10)).build();

      Example request:
        var requestBuilder = HttpRequest.newBuilder()
                  .uri(uri)
                  .timeout(Duration.ofSeconds(30))
                  .header("Content-type", "application/json");


      Example partial stack trace:
      "pool-1-thread-16" #52 prio=5 os_prio=0 cpu=8534.52ms elapsed=55491.00s tid=0x00007f30bc0f0000 nid=0x70 waiting on condition [0x000
      07f30eca08000]
         java.lang.Thread.State: WAITING (parking)
              at jdk.internal.misc.Unsafe.park(java.base@14.0.1/Native Method)
              - parking to wait for <0x00000000acfee3a8> (a java.util.concurrent.CompletableFuture$Signaller)
              at java.util.concurrent.locks.LockSupport.park(java.base@14.0.1/LockSupport.java:211)
              at java.util.concurrent.CompletableFuture$Signaller.block(java.base@14.0.1/CompletableFuture.java:1860)
              at java.util.concurrent.ForkJoinPool.managedBlock(java.base@14.0.1/ForkJoinPool.java:3137)
              at java.util.concurrent.CompletableFuture.waitingGet(java.base@14.0.1/CompletableFuture.java:1887)
              at java.util.concurrent.CompletableFuture.get(java.base@14.0.1/CompletableFuture.java:2062)
              at jdk.internal.net.http.HttpClientImpl.send(java.net.http@14.0.1/HttpClientImpl.java:543)
              at jdk.internal.net.http.HttpClientFacade.send(java.net.http@14.0.1/HttpClientFacade.java:119)
              at org.openjdk.skara.network.RestRequestCache.send(org.openjdk.skara.network/RestRequestCache.java:113)
        ...

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

              Created:
              Updated: