Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H2 Client connection brakes when ALPN resolved to H2 #3561

Closed
chamil321 opened this issue Oct 27, 2022 · 3 comments · Fixed by ballerina-platform/module-ballerina-http#1519
Closed
Assignees
Labels
module/http Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/PCM Protocol connector packages related issues Type/Bug
Milestone

Comments

@chamil321
Copy link
Contributor

Description:

public function main() returns error? {
    http:Client restCountriesEp = check new ("https://www.dataaccess.com/webservicesserver");
    http:Response countries = check restCountriesEp->get("/NumberConversion.wso");
    test:assertEquals(countries.statusCode, 200, msg = "Found unexpected output");
}

Steps to reproduce:

error: HTTP/2 stream 3 reset by the remote peer

Affected Versions:

OS, DB, other environment details and versions:

Related Issues (optional):

Suggested Labels (optional):

Suggested Assignees (optional):

@chamil321 chamil321 added Type/Bug module/http Team/PCM Protocol connector packages related issues labels Oct 27, 2022
@chamil321 chamil321 self-assigned this Oct 27, 2022
@Bhashinee Bhashinee assigned Bhashinee and unassigned chamil321 and Bhashinee Feb 16, 2023
@Bhashinee
Copy link
Member

Debugged the code and the following are the findings.

  • ALPN negotiation is getting successfully negotiated to h2 and then we create the h2 pipeline and move on.
  • Once we send the request client receives an RST frame from the server with the error code 1 which means an HTTP2 protocol error. That doesn't give us much information on the error.
    HTTP2 Protocol Error - The endpoint detected an unspecific protocol error. This error is for use when a more specific error code is not available.

trace logs

[2023-03-16 12:50:57,182] TRACE {http.tracelog.upstream} - [id: 0x8ced4fa1, L:/192.168.1.3:59482 - R:www.dataaccess.com/52.7.155.169:443] OUTBOUND SETTINGS: ack=false settings={MAX_HEADER_LIST_SIZE=8192}  
[2023-03-16 12:50:57,265] TRACE {http.tracelog.upstream} - [id: 0x8ced4fa1, L:/192.168.1.3:59482 - R:www.dataaccess.com/52.7.155.169:443] INBOUND SETTINGS: ack=false settings={=2, MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576}  
[2023-03-16 12:50:57,267] TRACE {http.tracelog.upstream} - [id: 0x8ced4fa1, L:/192.168.1.3:59482 - R:www.dataaccess.com/52.7.155.169:443] OUTBOUND SETTINGS: ack=true  
[2023-03-16 12:50:57,269] TRACE {http.tracelog.upstream} - [id: 0x8ced4fa1, L:/192.168.1.3:59482 - R:www.dataaccess.com/52.7.155.169:443] INBOUND WINDOW_UPDATE: streamId=0 windowSizeIncrement=983041  
[2023-03-16 12:50:57,292] TRACE {http.tracelog.upstream} - [id: 0x8ced4fa1, L:/192.168.1.3:59482 - R:www.dataaccess.com/52.7.155.169:443] OUTBOUND HEADERS: streamId=3 headers=DefaultHttp2Headers[:path: /webservicesserver/NumberConversion.wso, :method: GET, :scheme: http, :authority: www.dataaccess.com, user-agent: ballerina] streamDependency=0 weight=16 exclusive=false padding=0 endStream=true  
[2023-03-16 12:50:57,485] TRACE {http.tracelog.upstream} - [id: 0x8ced4fa1, L:/192.168.1.3:59482 - R:www.dataaccess.com/52.7.155.169:443] INBOUND SETTINGS: ack=true  
[2023-03-16 12:50:57,521] TRACE {http.tracelog.upstream} - [id: 0x8ced4fa1, L:/192.168.1.3:59482 - R:www.dataaccess.com/52.7.155.169:443] INBOUND RST_STREAM: streamId=3 errorCode=1 
  • I tried the same code with some other HTTP2-supported sites. And those work fine, which means that this is not happening for all the HTTP2 backends.

code

public function main() returns error? {
    http:Client restCountriesEp = check new ("https://www.wappalyzer.com/lookup");
    http:Response countries = check restCountriesEp->get("/wordpress.org/");
    io:println(countries.getTextPayload());
}

@dilanSachi
Copy link
Contributor

Tested this with a nghttp client. These were the outgoing headers,

:method: GET
:path: /webservicesserver/NumberConversion.wso
:scheme: https
:authority: www.dataaccess.com
accept: */*
accept-encoding: gzip, deflate
user-agent: nghttp2/1.52.0

However, ballerina client outgoing headers are follows.

:path: /webservicesserver/NumberConversion.wso
:scheme: http
:authority: www.dataaccess.com
:method: GET
user-agent: ballerina

The difference here is that even though the url is https, ballerina client sends the scheme as http. When the scheme is updated to https in ballerina client, request is successful.

@github-actions
Copy link

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

@dilanSachi dilanSachi added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Mar 28, 2023
@dilanSachi dilanSachi added this to the 2201.4.2 milestone Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/http Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/PCM Protocol connector packages related issues Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants