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

Connection from R using adbi (+adbcflightsql +adbcdrivermanager) logs "PRI * HTTP/2.0" HTTPStatus.HTTP_VERSION_NOT_SUPPORTED -" #9

Open
mskyttner opened this issue Feb 11, 2025 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mskyttner
Copy link

Trying to make a connection against a quackpy server to get "adbc all the way down" into an R client. See below, using R and having installed packages adbi, adbcflightsql and adbcdrivermanager, but first starting the quackpy server with docker run -ti --rm -p 8123:8123 -p 8815:8815 ghcr.io/quackscience/quackpy:latest:

con <- 
  adbi::dbConnect(adbi::adbi("adbcflightsql"), 
    uri = "grpc://127.0.0.1:8815"  #, username = "", password =""
  )

print(con)

Error reported on the client side:

Error in `adbcdrivermanager::adbc_connection_get_info()`:
! IO: [FlightSQL] connection error: desc = "error reading server preface: read tcp 127.0.0.1:44700->127.0.0.1:8815: read: connection reset by peer" (Unavailable; GetInfo(GetSqlInfo))
Hide Traceback
    ▆
 1. ├─methods (local) `<stndrdGn>`(`<AdbCnnct>`)
 2. └─adbi (local) `<stndrdGn>`(`<AdbCnnct>`)
 3.   ├─nanoarrow::convert_array_stream(adbcdrivermanager::adbc_connection_get_info(object@connection))
 4.   │ └─base::stopifnot(inherits(array_stream, "nanoarrow_array_stream"))
 5.   └─adbcdrivermanager::adbc_connection_get_info(object@connection)
 6.     └─adbcdrivermanager:::stop_for_error(status, error)

Possibly related lines in the log from the quackpy server side:

172.17.0.1 - - [11/Feb/2025 09:52:46] code 505, message Invalid HTTP version (2.0)
172.17.0.1 - - [11/Feb/2025 09:52:46] "PRI * HTTP/2.0" HTTPStatus.HTTP_VERSION_NOT_SUPPORTED -

This might well be operator error, but the equivalent way to connect to the Voltron "sqlflite" server works (just different uri). So I was guessing that maybe quackpy should support such a way to set up the connection?

Wondering also if there is an doc of how to do this in R already and specifically how to send credentials (in a conncetion against the sqlflite server these credentails are provided not in the connection uri but as separate parameters for username and password when setting up the connection).

@lmangani
Copy link
Contributor

lmangani commented Feb 11, 2025

Thanks for the report @mskyttner this is indeed expected as the default app server doesn't support HTTP/2
I created a branch https://github.com/quackscience/quackpy/tree/hypercorn using hypercorn which should support HTTP/2 but I won't have time to test it for a while. Could you give that a try locally?

NOTE: in quackpy currently authentication is only used for persistence - a unique combination of username+password (or token) results in the same duckdb file being used for persistence. This won't be the case in http_server etc

@lmangani lmangani added enhancement New feature or request help wanted Extra attention is needed labels Feb 11, 2025
@mskyttner
Copy link
Author

Thanks! I tried the hypercorn branch and it seems to run with no problem; the earlier log message with a HTTP2.0 complaint I haven't seen anymore.

I can successfully and reproducibly get a connection to the Voltron "sqlflite" server, but stuck on getting R to connect to the quackpy server for now.

Maybe it is related to setting up the "flight call options" when making the "adbi" connection. I raised an issue/question with adbi to see if someone can explain how to do this.

Current (failing) attempt using this R script tries to set adbc.flight.sql.authorization_header on the Flight SQL driver, but the log just says:

Error in adbcdrivermanager::adbc_statement_prepare(stmt) :
  IO: [FlightSQL] connection error: desc = "error reading server preface: read tcp 127.0.0.1:60258->127.0.0.1:8815: read: connection reset by peer" (Unavailable; Prepare)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants