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

error reading server preface: http2: frame too large #7961

Closed
yriahi opened this issue Jun 5, 2024 · 10 comments · Fixed by #7967
Closed

error reading server preface: http2: frame too large #7961

yriahi opened this issue Jun 5, 2024 · 10 comments · Fixed by #7967

Comments

@yriahi
Copy link

yriahi commented Jun 5, 2024

Description:

When I clone directly from the Docker container, it works as expected:

export DOLT_REMOTE_PASSWORD=password
dolt clone --user my-user http://localhost:8080/my_database my_database
cloning http://localhost:8080/my_database
cd my_database

Note: cloning from a sidecar container (another container within the same ECS task definition) works well too.

However, when I attempt to clone from my Dolt container running in AWS ECS via an Application Load Balancer (ALB), I encounter the following error:

dolt clone --user my-user http://***.elb.amazonaws.com:8080/my_database
cloning http://***.elb.amazonaws.com:8080/my_database

error: failed to get remote db

cause: could not access dolt url 'http://***.elb.amazonaws.com:8080/my_database':
rpc error: code = Unavailable desc = connection error: 
desc = "error reading server preface: http2: frame too large"

Additional Information:

  • Dolt version: 1.37.0. with the following remoteapi config

    remotesapi:
     port: 8080
     read_only: true
    
  • ALB configuration: HTTP only (so far for internal testing). idle_timeout increased to 120

Please let me know if you need any additional information to troubleshoot this issue.

Thank you.

@timsehn
Copy link
Contributor

timsehn commented Jun 5, 2024

Interesting. @reltuk will look into this.

@reltuk
Copy link
Contributor

reltuk commented Jun 5, 2024

@yriahi What's the listener and target rule configuration like for ***.elb.amazonaws.com:8080? Is it pointing at a dolt sql-server with a RemotesAPI exposed with something like --remotesapi-port=...?

RemotesAPI requires HTTP/2, and in plaintext mode it typically requires h2c, but ALB doesn't support h2c, at least at the client-to-LB hop. In this case, I think it might work if you:

  1. Make the listener protocol HTTP/2.
  2. Make the target group protocol HTTP/2.
  3. Change the client URL to use HTTPS, as per ALB HTTP/2 requirements.

Is that something that would be easy for you to try out?

@yriahi
Copy link
Author

yriahi commented Jun 6, 2024

Hi @reltuk
Thanks for your reply. I made the changes below, and I am getting a different error now - 502 (Bad Gateway). The service is running and I can clone directly from the dolt container while on a utility side car container.

  1. I changed the listener to HTTPS
    image

2.Ttarget group is on HTTPS, protocol version HTTP2, healthy ( I have 400 as a "good" healthy code - is there a proper remote api status health path?)
image

  1. Added a certificate to the ALB, and attempted a clone on https
export DOLT_REMOTE_PASSWORD=****
dolt clone --user my-user https://my-clone-dolt.com:8080/getting_started
cloning https://my-clone-dolt.com:8080/getting_started
error: failed to get remote db
cause: could not access dolt url 'https://my-clone-dolt.com:8080/getting_started': rpc error: code = Unavailable desc = unexpected HTTP status code received from server: 502 (Bad Gateway)

Thanks!

@reltuk
Copy link
Contributor

reltuk commented Jun 6, 2024

@yriahi I think the target group protocol should be HTTP, with protocol version will HTTP2.

@reltuk
Copy link
Contributor

reltuk commented Jun 6, 2024

And to answer the question about the health check endpoint:

Currently the remotesapi endpoint on sql-server does not expose a health check endpoint. A TCP ping or an HTTP request as something like GET /healthz marking healthy on a 4xx response is probably the right thing for now.

@yriahi
Copy link
Author

yriahi commented Jun 6, 2024

@reltuk - Thanks for catching that! Target Group protocol changed to HTTP

I got rid of the HTTPS 8080 ALB listener; and swapped to 443 instead for ease of use.

Looking better now with this initial message

image

...then this error ... :80 i/o timeout

image

I don't have anything anywhere in Terraform code with port 80; not sure where that is coming from. I will keep digging.

@reltuk
Copy link
Contributor

reltuk commented Jun 6, 2024

@yriahi Ahh, really good catch. Ok, so things probably work work end-to-end on the load balancer side.

What's happening here is this:

The remotesapi protocol generates links to itself and embeds them in responses to the dolt client. The dolt client then makes further requests to those links. In this case, the server itself is generating links for http://... instead of https://..., because the server itself is running a non-TLS listener.

The right thing to do is for the remotesapi server to respect X-Forwarded-Proto, and to generate the links with a scheme of https if the client is originally requesting with a scheme of https. I've opened a PR for that here: #7967.

I will keep you posted on when that fix is finalized, reviewed and released.

In the mean time, I think you might be able to make it work with the existing version of dolt if you also create an HTTP listener on port 80 of your ALB. I think it can forward to the same target group (if that's allowed in AWS?) or to a new one that forwards traffic to the same port. I think the traffic can either be forwarded at HTTP/1.1 or HTTP/2, but it should not be HTTPS.

Thanks for your patience and I hope to follow up shortly.

@yriahi
Copy link
Author

yriahi commented Jun 6, 2024

@reltuk thanks for working on this and submitting the PR.
I'll be creating/testing the non-TLS listener and report back.

@reltuk reltuk reopened this Jun 7, 2024
@reltuk
Copy link
Contributor

reltuk commented Jun 7, 2024

Didn't mean to close this until at least the release goes out. Sorry about that!

@reltuk
Copy link
Contributor

reltuk commented Jun 10, 2024

Closing this for now, as the x-forwarded-proto change is the in latest Dolt release, 1.39.4. Please feel free to reopen or comment here if you have any further questions or need continued ideas about iterating on getting ALBs working with older versions of Dolt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants