You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Roy Hashimoto (Jira)" <ji...@apache.org> on 2019/10/13 23:59:00 UTC

[jira] [Created] (HTTPCORE-606) HTTP2 framing layer error with HttpCore 5.0 server

Roy Hashimoto created HTTPCORE-606:
--------------------------------------

             Summary: HTTP2 framing layer error with HttpCore 5.0 server
                 Key: HTTPCORE-606
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-606
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore
    Affects Versions: 5.0-beta9
            Reporter: Roy Hashimoto
         Attachments: ConscryptTest.java

The attached file implements a simple H2/TLS server that returns a roughly 64 KB response. Things work fine when HTTP1 is used but with HTTP2 a framing layer error is reported.

Using curl:

{{$ curl -k https://localhost:8080/}}
{{curl: (16) Error in the HTTP2 framing layer}}

Using Chrome:

{{GET https://localhost:8080/ net::ERR_HTTP2_FRAME_SIZE_ERROR 200}}

I'm using Conscrypt (org.conscrypt:conscrypt-openjdk-uber:2.2.1) because I currently have only Java 8 environments so that's how I enable H2. I don't know if the bug is related to the JSSE implementation or not. I did try to disable TLS on the server and connect with {{curl --http2}} but that didn't work - curl offered to upgrade but the server returned HTTP1 and the error doesn't happen with HTTP1.

The response is big enough that writing the response body data to the DataStreamChannel does not consume it all in one call. I believe this might be a factor because if I instead dribble the data out with small writes over time like this then no error occurs:

{{private int counter = 0;}}
{{@Override}}
{{public void produce(DataStreamChannel channel) throws IOException {}}
{{  if (counter < 4096) {}}
{{    ByteBuffer buffer = ByteBuffer.wrap(String.format("%4d:0123456789\n", counter).getBytes());}}
{{    counter++;}}
{{    channel.write(buffer);}}
{{    new Thread(() -> {}}
{{      try {}}
{{        Thread.sleep(50);}}
{{      } catch (InterruptedException ignored) {}}
{{      }}}
{{      channel.requestOutput();}}
{{    }).start();}}
{{  } else {}}
{{    channel.endStream();}}
{{  }}}
{{}}}

To run the test program you will need to modify the code at the beginning of {{main}} to load your own X509 KeyStore. Connect to the server with an H2-capable client on port 8080.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org