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 in result_fetch(res@ptr, n = n) : Error fetching buffer: #135

Closed
mistermichaelll opened this issue Apr 27, 2019 · 25 comments
Closed
Milestone

Comments

@mistermichaelll
Copy link

Just updated R to version 3.6.0 and was looking through some old projects to make sure everything still ran smoothly. I have a Shiny app which accesses a local server, but now the server will not connect and throws the error in the title when trying to access specific tables in the database.

R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.3

other attached packages:
 [1] gtable_0.3.0     gridExtra_2.3    ggthemes_4.1.1   ggplot2_3.1.1   
 [5] kableExtra_1.1.0 knitr_1.22       tidyr_0.8.3      lubridate_1.7.4 
 [9] RMariaDB_1.0.6   DBI_1.0.0        dbplyr_1.4.0     dplyr_0.8.0.1   
[13] shiny_1.3.2  
> bb_db <- DBI::dbConnect(RMariaDB::MariaDB(),
>                         db = Sys.getenv("DB"),
>                         host = Sys.getenv("HOST"),
>                         port = 3306,
>                         user = Sys.getenv("USERNAME"),
>                         password = Sys.getenv("PASSWORD"))
> bb_db
<MariaDBConnection>
 Host:     anonymized.host.url
 Server:   5.5.62-0ubuntu0.14.04.1
 Client:   10.3.6
>
> tbl(bb_db, "bb")
Error in result_fetch(res@ptr, n = n) : Error fetching buffer:
> 

I saw this issue in some older reports, but I never came across it until just today when I updated R. So I thought I would report the issue just in case it has anything to do with that.

@uhkeller
Copy link

I have the same problem, also with R 3.6.0 on Mojave. Installing RMariaDB from source did not help. Anything that tries to fetch results fails (I've tried dbListTables() and simple queries with dbGetQuery()). For now, I've switched back to RMySQL.

@SymbolixAU
Copy link

We had the same problem too. I could make it work on ubuntu (with a recent install of mysql-client) but it failed on Mohave and Sierra. All were using R3.6.0

I tried installing from source and got a warning WARNING: Connector versions prior to 2.3.4/3.0.3 have a known problem with retrieving string and blob data. See https://github.com/r-dbi/RMariaDB/issues/53 for details. Following #53 and #69 I figured that the connector-c had been broken when we updated RMariaDB

My workaround was to install up to date versions of mysql-client

brew install mysql-client
brew link --force mysql-client

The second link forces the brew version to be the default - importantly it forces the C compiler to link to the brew libraries.

Then in R I installed from source

install.packages('RMariaDB', type = "source")

And it worked. Hope that helps!

@mistermichaelll
Copy link
Author

My workaround was to install up to date versions of mysql-client

brew install mysql-client
brew link --force mysql-client

The second link forces the brew version to be the default - importantly it forces the C compiler to link to the brew libraries.

Then in R I installed from source

install.packages('RMariaDB', type = "source")

And it worked. Hope that helps!

Thanks a lot! That workaround also worked for me.

@ben519
Copy link

ben519 commented May 5, 2019

This almost worked for me, but brew link --force mysql-client gave the error

Linking /usr/local/Cellar/mysql-client/5.7.23... 
Error: Could not symlink bin/my_print_defaults
Target /usr/local/bin/my_print_defaults
is a symlink belonging to mysql-connector-c. You can unlink it:
  brew unlink mysql-connector-c

To force the link and overwrite all conflicting files:
  brew link --overwrite mysql-client

brew link --force --overwrite mysql-client then install.packages('RMariaDB', type = "source") did the trick.

@krlmlr
Copy link
Member

krlmlr commented May 6, 2019

Thanks. So, installing MySQL client drivers is the only solution on macOS? Did anyone succeed with the MariaDB connector?

@ben519
Copy link

ben519 commented May 6, 2019

I tried mysql-connector-c and mariadb-connector-c, neither with success.

@mistermichaelll
Copy link
Author

I tried mysql-connector-c and mariadb-connector-c, neither with success.

Can second this. Tried both of these before the workaround mentioned above.

@uhkeller
Copy link

In case there are more MacPorts users with this problem: I got it to work by installing the mariadb port, adding /opt/local/lib/mariadb/bin/ to the PATH (by creating a file containing this path in /etc/paths.d/), restarting R to make it pick up the changed PATH, and the re-installing RMariaDB from source.

@verajosemanuel
Copy link

verajosemanuel commented Jun 26, 2019

same problem here Mac OS Mojave. Solved with mentioned brew workaround. Installing MariaDB connector did not work

@ankane
Copy link

ankane commented Jul 9, 2019

fwiw, I also ran into this error when upgrading to R 3.6.0 (with MariaDB 10.3.11). The workaround above didn't work for me, but upgrading to MariaDB 10.4.6 and reinstalling RMariaDB from source fixed it.

@RaphaelRoethlin
Copy link

RaphaelRoethlin commented Oct 19, 2019

I had the same issue in macOS Mojave and in the end it worked, but after

brew install mysql-client
brew link --force mysql-client

I needed an additional step to be able to re-install RMariaDb in RStudio without the following Error:

ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib'
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This worked for me before re-installing RMariaDb:

brew uninstall --ignore-dependencies --force openssl
brew install openssl

[https://blog.twobucks.co/ld-warning-directory-not-found-for-option/]

@SymbolixAU
Copy link

An update

install.packages('RMariaDB', type = "source")

may no longer work (depending no your system configuration, you may get a load of C++ compiler errors), but

devtools::install_github("r-dbi/RMariaDB")

just worked for me this time

@krlmlr
Copy link
Member

krlmlr commented Dec 14, 2019

@jeroen: Any idea how to fix the binary build for the Mac? Do you know (or know how to find out) what libraries CRAN is using, so that we can replicate locally?

@jeroen
Copy link
Member

jeroen commented Dec 14, 2019

Right now we build against mariadb-connector-c-3.0.8 from autobrew, unless Simon changed something on the server. I could update that to 3.1.5 if that helps?

Do you know (or know how to find out) what libraries CRAN is using, so that we can replicate locally?

Maybe we should improve RMariaDB::mariadbClientLibraryVersions() to give more details.

@jeroen
Copy link
Member

jeroen commented Dec 14, 2019

What is the easiest way for me to reproduce this problem on macos? Does it happen when running a local postgres server ?

@krlmlr
Copy link
Member

krlmlr commented Dec 14, 2019

I think a local MySQL or MariaDB server is enough to reproduce the problem.

I'll look into giving better output with dbGetInfo() for the connection object.

@jeroen
Copy link
Member

jeroen commented Dec 14, 2019

But why doesn't it fail on travis then?

@krlmlr
Copy link
Member

krlmlr commented Dec 14, 2019

I think this issue is about failures with installations of packages pre-built by CRAN?

@jeroen
Copy link
Member

jeroen commented Dec 14, 2019

We simulate CRAN on Travis with the build that has disable_homebrew: true. But I've reproduced the problem locally, let's see if it goes away with a more recent mariadb-connector-c....

@jeroen
Copy link
Member

jeroen commented Dec 14, 2019

I believe this problem has been solved by updating mariadb-connector-c that we use to build the CRAN binaries from 3.0.8 to 3.1.6. I can no longer reproduce this problem locally.

But you need to resubmit to CRAN to trigger a new build of the R binary package.

@krlmlr
Copy link
Member

krlmlr commented Dec 14, 2019

Thanks, will do!

@jeroen
Copy link
Member

jeroen commented Dec 14, 2019

I'll also submit a new version of RMySQL, just to be sure. Although it seems like this may have been a bug in mariadb-connector-c 3.0.5 in a part of the code that is not used by RMySQL.

@jeroen
Copy link
Member

jeroen commented Dec 16, 2019

FYI, the new version RMySQL 0.10.18 on cran is now built with mariadb-connector-c to 3.1.6.

@krlmlr krlmlr added this to the RMariaDB 1.1.0 milestone Dec 17, 2019
@krlmlr krlmlr modified the milestones: 1.1.0, 1.2.0 Jan 5, 2021
@krlmlr
Copy link
Member

krlmlr commented Dec 6, 2021

Closing for now, please open a new issue if problems persist.

@krlmlr krlmlr closed this as completed Dec 6, 2021
@github-actions
Copy link

github-actions bot commented Dec 7, 2022

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants