Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-2122

Details of H2ConnectionException are omitted by ConnectionClosedException

    XMLWordPrintableJSON

Details

    Description

      As said in a comment of ticket HTTPCLIENT-2120 following a description of the error handling issue:

      When I unbiasedly tried to establish a HTTP/2 connection via HTTP-Proxy I noticed that in the logs there is a frame size error that is not obvious from the exception thrown by Future<SimpleHttpResponse>.get():

      • In the logs I can see Code FRAME_SIZE_ERROR and Frame size exceeds maximum which might be caused by trying to consume the HTTP-1.1 proxy response as HTTP/2
        • The associated Exception (H2ConnectionException: Frame size exceeds maximum) is omitted in org.apache.hc.core5.http2.impl.nio.AbstractH2StreamMultiplexer.onException(Exception) where ((ExecutableCommand) command).failed(new ConnectionClosedException()) is called

      The following snipped can be used to reproduce the issue (coconutpi:8080 points to a basic squid 4.6 setup on a raspberry pi in my home network):

      CloseableHttpAsyncClient client = HttpAsyncClients.custom().setVersionPolicy(HttpVersionPolicy.FORCE_HTTP_2)
              .setProxy(HttpHost.create("coconutpi:8080")).build();
      client.start();
      // throws org.apache.hc.core5.http.ConnectionClosedException: Connection is closed
      client.execute(SimpleHttpRequests.get("https://http2.pro/client"), null).get();
      

      StackTrace of exception thrown by Future<SimpleHttpResponse>.get():

      ava.util.concurrent.ExecutionException: org.apache.hc.core5.http.ConnectionClosedException: Connection is closed
      	at org.apache.hc.core5.concurrent.BasicFuture.getResult(BasicFuture.java:72)
      	at org.apache.hc.core5.concurrent.BasicFuture.get(BasicFuture.java:85)
      	at com.test.MinimalProxyTest.basicTest(MinimalProxyTest.java:40)
      	at com.test.MinimalProxyTest.main(MinimalProxyTest.java:26)
      Caused by: org.apache.hc.core5.http.ConnectionClosedException: Connection is closed
      	at org.apache.hc.core5.http2.impl.nio.AbstractH2StreamMultiplexer.onException(AbstractH2StreamMultiplexer.java:661)
      	at org.apache.hc.core5.http2.impl.nio.AbstractH2IOEventHandler.exception(AbstractH2IOEventHandler.java:91)
      	at org.apache.hc.core5.http2.impl.nio.ClientH2IOEventHandler.exception(ClientH2IOEventHandler.java:39)
      Caused by: org.apache.hc.core5.http.ConnectionClosedException: Connection is closed
      	at org.apache.hc.core5.reactor.InternalDataChannel.onException(InternalDataChannel.java:162)
      	at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:55)
      	at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:179)
      	at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:128)
      	at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:85)
      	at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      

      StackTrace of the omitted exception:

      org.apache.hc.core5.http2.H2ConnectionException: Frame size exceeds maximum
      	at org.apache.hc.core5.http2.impl.nio.FrameInputBuffer.read(FrameInputBuffer.java:101)
      	at org.apache.hc.core5.http2.impl.nio.AbstractH2StreamMultiplexer.onInput(AbstractH2StreamMultiplexer.java:440)
      	at org.apache.hc.core5.http2.impl.nio.AbstractH2IOEventHandler.inputReady(AbstractH2IOEventHandler.java:65)
      	at org.apache.hc.core5.http2.impl.nio.ClientH2IOEventHandler.inputReady(ClientH2IOEventHandler.java:39)
      	at org.apache.hc.core5.reactor.InternalDataChannel.onIOEvent(InternalDataChannel.java:124)
      	at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)
      	at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:179)
      	at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:128)
      	at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:85)
      	at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      

      The complete session log can be found in the attachment hc5_session.log.

      Attachments

        1. hc5_session.log
          11 kB
          synth3

        Activity

          People

            Unassigned Unassigned
            synth3 synth3
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: