Something wrong with the 1.4.5 Mac binary on CRAN with Redshift
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 343
- Forks
- 82
- Avg merge
- 11h 26m
- Merged PRs (30d)
- 9
Description
I discovered an odd issue, which I thought I'd report and can help troubleshoot if needed. The tl;dr is that I cannot connect to one Redshift server with the Mac binary from CRAN, but can if I compile from source.
The current Mac binary of RPostgres (1.4.5) seems to have an issue with some, but not all, Redshift servers. The command I'm running is
DBI::dbConnect(RPostgres::Redshift(), ...) # same result with RPostgres::Postgres()
and the error I get is:
connection to server at "<host>" (<ip>), port 5439 failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The error message is the same also when I don't provide a valid username/password, so it seems to happen before authentication.
The weird thing is that I get this error with only one Redshift server (our production one) and not with another (our staging) – even though they're both running the same version. Also, I can connect to both with psql from my Mac, and can connect to both with RPostgres from within a docker container running on my Mac. This made me suspect it is somehow related to the Mac version of RPostgres. And in fact, if instead of installing the binary from CRAN I compile it from source with (I have libpq installed with Homebrew):
install.packages("RPostgres", type = "source")
The problem goes away and I can connect to both servers.
I don't know if the solution is to simply recompile the Mac binary version that is available on CRAN, and that will fix it. If not, I can help troubleshoot on my end, in case that helps. The fact that this seems to affect some, but not all, Redshift servers can understandably make this hard the reproduce. Is there something I can do to see debugging messages from RPostgres/DBI?
My sessionInfo():
R version 4.2.3 (2023-03-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur ... 10.16
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] bit_4.0.5 compiler_4.2.3 cli_3.6.1 hms_1.1.3
[5] DBI_1.1.3 Rcpp_1.0.11 bit64_4.0.5 vctrs_0.6.3
[9] blob_1.2.4 lifecycle_1.0.3 pkgconfig_2.0.3 rlang_1.1.1
[13] RPostgres_1.4.5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing DBI::dbConnect(RPostgres::Redshift(), ...) with the CRAN Mac binary and with install.packages("RPostgres", type = "source") on the reported macOS setup. Compare the behavior against both Redshift servers and the available libpq/build details; done means identifying the binary-specific cause or a reproducible fix for connections to the affected server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, postgresql, r
- Domain
- build-system, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100