-
Notifications
You must be signed in to change notification settings - Fork 79
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 attempt to arcadedb (supports the Postgres wire format for connection and queries) fails with "received invalid response to GSSAPI negotiation: R" #363
Comments
Thanks. When I try to start the Docker image on a machine with 2 GB, the SSH connection gets disconnected (!). When I try to limit the memory with What are the memory requirements for this image? |
I tried looking for memory limits for arcadedb (and the earlier orientdb) and couldn't really find a good link/doc, but I saw some mentions in various places for 2, 4, 6 and 8 GB. For what it is worth, I did not set any specific limits (which I think means that the docker image will use as much as it needs from available memory on the host) and my "docker stats" then reports 2.2 GB memory used by arcadedb when loaded with the data here (OpenBeer database). I tried setting some environment variables to disable SSL (recommended by arcadedb team) and Kerberos when making the connection, but get a "hang" and also no indication of OOM on the two machines where I have tested this. library(RPostgres)
library(DBI)
#Sys.setenv(PGGSSENCMODE="disable")
#Sys.unsetenv("PGGSSENCMODE")
#Sys.unsetenv("PGSSLMODE")
#Sys.setenv(PGSSLMODE="disable")
con <- dbConnect(
RPostgres::Postgres(),
#gssencmode = 'disable',
#sslmode = "disable",
dbname = 'Imported',
host = 'localhost',
port = 5432,
user = 'root',
password = 'playwithdata'
) |
You can set in ArcadeDB's docker The default Dockerfile sets To run ArcadeDB with 1G docker container, you could start ArcadeDB by using 800M for RAM:
|
Added this paragraph hoping it helps a little more on this subject. Any suggestions to improve it are welcome: https://docs.arcadedb.com/#DockerTuning |
Thanks. I have now added enough memory, I'm seeing now: GGSSENCMODE=require psql -d Imported -h localhost -p 5432 -U root
# ... not supported When running the R code, con <- DBI::dbConnect(
RPostgres::Postgres(),
dbname = 'Imported',
host = 'localhost',
port = 5432,
user = 'root',
password = 'playwithdata'
) The Docker container is also silent. |
FWIW, once this is fixed, a good way to help us remain compatible is to add a job to the check matrix, see #368. |
@krlmlr you can add this setting to the container to print messages from postgres protocol: Also, how can I reproduce the same on my side? I never used |
Thanks. To replicate from the R side, you can use the following minimal Dockerfile:
In an interactive Docker shell, use |
I don't know much about arcadedb, happy to review a pull request if we can't fix it with configuration. And of course a new entry to the GitHub Actions check matrix! |
Thanks for your help. The issue was in ArcadeDB and in the way the protocol was managed. |
Tested with this script and works: .libPaths( c( "/usr/local/lib/R/lib" , .libPaths() ) )
r = getOption("repos")
r["CRAN"] = "http://cran.us.r-project.org"
options(repos = r)
##install.packages(c("RPostgres"), lib="/usr/local/lib/R/lib")
##install.packages(c("DBI"), lib="/usr/local/lib/R/lib")
library(DBI)
#Sys.setenv(PGGSSENCMODE="disable")
#Sys.unsetenv("PGGSSENCMODE")
#Sys.unsetenv("PGSSLMODE")
#Sys.setenv(PGSSLMODE="disable")
con <- dbConnect(
RPostgres::Postgres(),
gssencmode = 'disable',
sslmode = "disable",
dbname = 'Beer',
host = 'localhost',
port = 5432,
user = 'root',
password = 'playwithdata'
)
print("EXECUTING QUERY")
res <- dbSendQuery(con, "select * from Brewery limit 10")
print("FETCHING RESULTS")
dbFetch(res)
print("CLEARING RESULTS")
dbClearResult(res)
dbDisconnect(con) |
Thanks! What's the best way to set up ArcadeDB on GitHub Actions? Would you like to contribute an entry to our check matrix? |
@robfrank what's the best way to do that? |
@lvca I tried pulling the latest image and these commands were successful: # run arcadedb locally
docker run --rm \
-p "2480:2480" \
-p "2424:2424" \
-p "5432:5432" \
--env ARCADEDB_OPTS_MEMORY="-Xms3G -Xmx3G" \
--env arcadedb.postgres.debug=true \
--env arcadedb.server.rootPassword=playwithdata \
--env "arcadedb.server.defaultDatabases=Imported[root]{import:https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz}" \
--env arcadedb.server.plugins="Postgres:com.arcadedb.postgres.PostgresProtocolPlugin" \
arcadedata/arcadedb:latest
# install psql
sudo apt install postgresql-client-common postgresql-client-14 # install psql
# query
PGGSSENCMODE=disable PGPASSWORD=playwithdata psql -d Imported -h localhost -p 5432 -U root -c 'select name from Beer limit 1' -o /dev/stdout Omitting the Using a Dockerfile for a more reproducible environment I tried this variant of what @krlmlr recommended earlier, it just adds psql: FROM rocker/r-rspm:20.04
RUN R -q -e 'install.packages("pak")'
RUN R -q -e 'pak::pak("RPostgres", dependencies = TRUE)'
RUN R -q -e 'pak::pak(c("pkgload", "pkgbuild"), dependencies = TRUE)'
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
libpq-dev \
postgresql-client-common \
postgresql-client-12 \
tini
RUN git clone https://github.com/r-dbi/RPostgres && \
cd RPostgres && R -q -e 'pkgload::load_all()'
WORKDIR RPostgres
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
CMD R After building the image locally with pgsqlRunning pgsql seems to work (omittig the PGGSSENCMODE setting does not even cause any issues or warnings it seems): # note the docker option below for using network=host in order to be able to access the arcadedb instance running on the host from inside the container
docker run --rm --network=host -it rcade bash -c "PGGSSENCMODE=disable PGPASSWORD=playwithdata psql -d Imported -h localhost -p 5432 -U root -c 'select name from Beer limit 1' -o /dev/stdout"
name
-------------
Hocus Pocus
(1 row) RPostgresThe RPostgres connection returns the same data (with some warnings) for the same simple test query: docker run --network=host -it rcade R -e "library(DBI);library(RPostgres);con <- dbConnect(RPostgres::Postgres(), gssencmode = 'disable', sslmode = 'disable', dbname = 'Imported', host = 'localhost', port = 5432, user = 'root', password = 'playwithdata');dbGetQuery(con, 'select name from Beer limit 1')"
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to create bus connection: Host is down
Warning messages:
1: In system("timedatectl", intern = TRUE) :
running command 'timedatectl' had status 1
2: Invalid time zone 'UTC', falling back to local time.
Set the `timezone` argument to a valid time zone.
CCTZ: Unrecognized timezone of the input vector: ""
3: In result_fetch(res@ptr, n = n) :
Don't need to call dbFetch() for statements, only for queries
name
1 Hocus Pocus
Actually, leaving out settings for gssencmode and sslmode also seems to "work" if we disregard those warnings (PID1, "host is down", SET statements vs query and dbFetch), if trying this: docker run --network=host -it rcade R -e "library(DBI);library(RPostgres);con <- dbConnect(Postgres(), dbname = 'Imported', host = 'localhost', port = 5432, user = 'root', password = 'playwithdata');dbGetQuery(con, 'select name from Beer limit 1')" Logs from arcadedb when RPostgres query runsA couple of statements related to timezone setting etc seem may be the cause of those warnings? 2022-01-05 11:10:41.516 INFO [PostgresNetworkExecutor] PSQL:-> request for password (R - 8b) (thread=51)
2022-01-05 11:10:41.516 INFO [PostgresNetworkExecutor] PSQL:-> authentication ok (R - 8b) (thread=51)
2022-01-05 11:10:41.517 INFO [PostgresNetworkExecutor] PSQL:-> backend key data (K - 12b) (thread=51)
2022-01-05 11:10:41.517 INFO [PostgresNetworkExecutor] PSQL:-> parameter status (S - 24b) (thread=51)
2022-01-05 11:10:41.517 INFO [PostgresNetworkExecutor] PSQL:-> parameter status (S - 25b) (thread=51)
2022-01-05 11:10:41.517 INFO [PostgresNetworkExecutor] PSQL:-> parameter status (S - 25b) (thread=51)
2022-01-05 11:10:41.517 INFO [PostgresNetworkExecutor] PSQL:-> ready for query (Z - 5b) (thread=51)
2022-01-05 11:10:41.517 INFO [PostgresNetworkExecutor] PSQL: query -> set client_encoding to 'UTF-8' (thread=51)
2022-01-05 11:10:41.518 INFO [PostgresNetworkExecutor] PSQL:-> ready for query (Z - 5b) (thread=51)
2022-01-05 11:10:41.520 INFO [PostgresNetworkExecutor] PSQL: query -> SET datestyle to 'iso, mdy' (thread=51)
2022-01-05 11:10:41.520 INFO [PostgresNetworkExecutor] PSQL:-> row description (T - 6b) (thread=51)
2022-01-05 11:10:41.520 INFO [PostgresNetworkExecutor] PSQL:-> command complete (C - 5b) (thread=51)
2022-01-05 11:10:41.520 INFO [PostgresNetworkExecutor] PSQL:-> ready for query (Z - 5b) (thread=51)
2022-01-05 11:10:41.521 INFO [PostgresNetworkExecutor] PSQL: query -> SET TIMEZONE = 'UTC' (thread=51)
2022-01-05 11:10:41.521 INFO [PostgresNetworkExecutor] PSQL:-> row description (T - 6b) (thread=51)
2022-01-05 11:10:41.522 INFO [PostgresNetworkExecutor] PSQL:-> command complete (C - 5b) (thread=51)
2022-01-05 11:10:41.522 INFO [PostgresNetworkExecutor] PSQL:-> ready for query (Z - 5b) (thread=51)
2022-01-05 11:10:41.696 INFO [PostgresNetworkExecutor] PSQL: query -> SELECT oid, typname FROM pg_type (thread=51)
2022-01-05 11:10:41.696 INFO [PostgresNetworkExecutor] PSQL:-> row description (T - 6b) (thread=51)
2022-01-05 11:10:41.696 INFO [PostgresNetworkExecutor] PSQL:-> command complete (C - 13b) (thread=51)
2022-01-05 11:10:41.696 INFO [PostgresNetworkExecutor] PSQL:-> ready for query (Z - 5b) (thread=51)
2022-01-05 11:10:41.698 INFO [PostgresNetworkExecutor] PSQL: parse (portal=) -> select name from Beer limit 1 (params=0) (errorInTransaction=false thread=51)
2022-01-05 11:10:41.698 INFO [PostgresNetworkExecutor] PSQL:-> parse complete (1 - 4b) (thread=51)
2022-01-05 11:10:41.698 INFO [PostgresNetworkExecutor] PSQL: sync (thread=51)
2022-01-05 11:10:41.698 INFO [PostgresNetworkExecutor] PSQL:-> ready for query (Z - 5b) (thread=51)
2022-01-05 11:10:41.698 INFO [PostgresNetworkExecutor] PSQL: describe '' type=S (errorInTransaction=false thread=51)
2022-01-05 11:10:41.698 INFO [PostgresNetworkExecutor] PSQL:-> no data (n - 4b) (thread=51)
2022-01-05 11:10:41.698 INFO [PostgresNetworkExecutor] PSQL: sync (thread=51)
2022-01-05 11:10:41.698 INFO [PostgresNetworkExecutor] PSQL:-> ready for query (Z - 5b) (thread=51)
2022-01-05 11:10:41.699 INFO [PostgresNetworkExecutor] PSQL: bind (portal=) -> (thread=51)
2022-01-05 11:10:41.699 INFO [PostgresNetworkExecutor] PSQL:-> bind complete (2 - 4b) (thread=51)
2022-01-05 11:10:41.699 INFO [PostgresNetworkExecutor] PSQL: describe '' type=P (errorInTransaction=false thread=51)
2022-01-05 11:10:41.699 INFO [PostgresNetworkExecutor] PSQL:-> row description (T - 29b) (thread=51)
2022-01-05 11:10:41.700 INFO [PostgresNetworkExecutor] PSQL: execute (portal=) (limit=0)-> select name from Beer limit 1 (thread=51)
2022-01-05 11:10:41.700 INFO [PostgresNetworkExecutor] PSQL:-> 1 row data (22b) (thread=51)
2022-01-05 11:10:41.700 INFO [PostgresNetworkExecutor] PSQL:-> command complete (C - 13b) (thread=51)
2022-01-05 11:10:41.700 INFO [PostgresNetworkExecutor] PSQL: sync (thread=51)
2022-01-05 11:10:41.700 INFO [PostgresNetworkExecutor] PSQL:-> ready for query (Z - 5b) (thread=51) |
I'm not sure about the best way, but here is a stab at an GHA which sets up ArcadeDB with example data and tests the connection using psql: https://github.com/mskyttner/rcade/blob/master/.github/workflows/arcadedb-connection.yaml |
About the warnings above, all the SET commands are simply ignored (even though some settings could be used, as the timezone - I'm checking):
|
Hmmm... I think the log entries in the arcadedb log come from running this R code: Just speculating here, better insights can probably be provided by @krlmlr - I'm just a humble user :) - but for the first point, the timedatectl (even if it is present in the container) might require systemd running which it isn't and probably couldn't be expected to at least not inside a container (I have seen that some containers in this community often use supervisord or s6-init instead when there are such needs)? |
Attempting to connect to arcadedb which claims to support the Postgres wire format for connections and queries, an error "received invalid response to GSSAPI negotiation: R" appears.
Brief description of the problem
It appears as GSSAPI is used by default, which throws the error, but R hangs when I try to disable this when making a connection.
The RJDBC library is able to make a connection and read data from a table using the latest official Postgres JDBC-driver.
Related to #174 (but it seems I want to do the opposite and disable GSSAPI negotiation, and when trying to do so R hangs)
The text was updated successfully, but these errors were encountered: