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
Add check for the LibR.so that rsession believes it's using #9893
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elegant solution! Very excited to see this improve for users.
* Verify that we can load a library (without actually loading it) | ||
* by passing RTLD_NOLOAD to dlopen | ||
*/ | ||
Error verifyLibrary(const std::string& libPath, void** ppLib) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you never use ppLib
, I don't think you should call it here. You're also never closing the handle on success, but I'm not sure if that matters.
-1, | ||
"Attempt to verify library failed", | ||
ErrorLocation()); | ||
error.addProperty("lib-path", libPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error.addProperty("lib-path", libPath); | |
error.addProperty("path", libPath); |
src/cpp/session/SessionMain.cpp
Outdated
if (!ensureLibRSoValid()) | ||
LOG_ERROR_MESSAGE(s_libRSoWarning + | ||
". Linux may have loaded a different libR.so than requested." | ||
" R_HOME: " + rsession::module_context::rHomeDir() + | ||
", R Version: " + rsession::module_context::rVersion()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than use a static which isn't thread safe, we should log this error message from within the ensureLibRSoValid()
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, should we exit here? Or at the very list emit a similar error to the R Console so that the user can be informed? IIRC, this error message will only go to our log files, and a big problem with this behaviour is that the user is unware that they're using the wrong version of R. We should probably include a note about contacting your system administrator if the versions don't match.
Add warning to user's console Update warning text Clean up verifyLibrary() prototype
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Is this really fixed? Especially if R is installed in a non-default location, problems with https://community.rstudio.com/t/r-shared-library-usr-local-lib64-r-lib-libr-so-not-found/131446/8 https://support.posit.co/hc/en-us/articles/200488508-RStudio-Desktop-IDE-Will-Not-Start |
This is really not fixed. I'm still having the same problem. I've tried setting the path to R and R libraries in all of the places the docs say. For instance, error while loading shared libraries: libR.so - R Admins - Posit Community r - RStudio Server (community) can't find libR.so even though it is in path - Stack Overflow /usr/local/lib64/R/lib/libR.so: cannot open shared object file: No such file or directory - Stack Overflow r - Error with shared library with RStudio Server - Stack Overflow r - error while loading shared libraries: libR.so - Stack Overflow error while loading shared libraries: libR.so: cannot open shared object file ubuntu - libR.so not found in R Rstudio - Stack Overflow R shared library (/usr/local/lib/R/lib/libR.so) not found. If this is a custom build of R, was it built with the --enable-R-shlib option? - RStudio IDE - Posit Community Rstudio error "R shared library (/usr/local/lib/R/lib/libR.so) not found." - RStudio IDE - Posit Community [R] R shared library (/usr/lib64/R/lib/libR.so) not found. RStudio Server (community) can't find libR.so even though it is in path. · Issue #12281 · rstudio/rstudio |
How about just adding a switch to |
Intent
Addresses https://github.com/rstudio/rstudio-pro/issues/2477 by adding a check on the
libR.so
thatrsession
believes it is running. If there are issues with loading that shared object, generate an error.Note that this does not fix the problem. Instead it creates an error that can be used to find and fix the cause of the problem, which is a system environment issue
Approach
The linked issue describes the problem in detail, but essentially while linux is loading the
rsession
binary, if there's an issue withlibR.so
, it may load a differentlibR.so
withoutrsession
's knowledge. To address this, we check for issues manually oncersession
is fully loaded by callingdload()
withRTLD_NOLOAD
. Any issues Linux had with loading the shared object will become apparent with that call, and the error can then be forwarded on to an error.This is linux-only code; Windows and MacOS won't perform this check.
Automated Tests
There are no unit tests included. Integration tests will require:
R
installationsR
installR
installR
version'slibR.so
before the test bychmod
ing out permissions so it can't be opened, and then restoring the permissions after the test is doneThe test should include
rsession
with the default systemR
installR
version to the broken custom versionQA Notes
None, see testing section above for how to reproduce/test
Checklist
NEWS.md