Comments (11)
Ideally, you should use R CMD
to setup the environment, so if let's say if you are running
sh startme.sh
then for Java to work you'd run
R CMD sh startme.sh
instead. Alternatively, whatever you're starting can use R CMD sh -c set
to get all the necessary R environment variables.
from rapache.
We should probably do this before our call to Rf_initEmbeddedR
at https://github.com/jeffreyhorner/rapache/blob/master/mod_R.c#L973-L1010
from rapache.
What's happening is that the linux service script(unity, init, system, etc.) ought to be amended to update the LD_LIBRARY_PATH (And other side effects of R CMD sh) prior to starting the server. Typically, the service script runs in a minimal environment.
I've known about this issue for a long time, but I'm not sure the best way to fix it.
from rapache.
Here's a version of the init script that ultimately get's placed into /etc/init.d/apache2 on ubuntu:
It references a file that's typically located at /etc/apache2/envvars
Maybe we need an additional config tool that outputs the side effects of R CMD sh
and update that!
from rapache.
Modifying global apache configs is difficult to setup and sound dangerous, especially if people are running other (non-R) websites on the same apache box.
Can we just output the variables we need to a file and run base::readRenviron()
to source them? Or is there more to it than setting environment variables?
from rapache.
You'll see in the /etc/init.d/apache2 script that the environment has to be set up at the invocation of apachectl. The facility for setting up that enviroment seems to be defined by the content of /etc/apache2/envvars, which would affect all the sites including non-R sites.
from rapache.
Something like this would populate the R environment to /etc/apache2/envvars:
#!/bin/bash
# save this to /tmp/exportenv.sh
for i in `env`; do
echo export $i
done
Then run
/usr/bin/env -i R CMD sh /tmp/exportenv.sh >> /etc/apache2/envvars
But this doesn't solve it completely as there are some env vars that contain spaces like:
LN_S=ln -s
So that shows up as two lines in the /etc/apache2/envvars like this:
export LN_S=ln
export -s
And then there are other strange env vars like:
export _=/usr/bin/env
from rapache.
I really don't like hardcoding that stuff in /etc/apache2/envvars
. It becomes a mess when you upgrade R and then need to re-do this stuff. I guess I need to hack a runtime solution.
from rapache.
What I don't understand is what R CMD sh
does beyond the things in /usr/lib/R/etc/ldpaths
?
from rapache.
Just confirming that I was able to solve the same issue by adding export LD_LIBRARY_PATH=/usr/lib/jvm/default-java/jre/lib/amd64/server
(directory with libjvm.so
- can differ) to /etc/apache2/envvars
.
Another issue arose however from the same rJava-dependent function call (mailR::send.mail) which works fine as user www-data
from the terminal. No response is received and the apache2 logs show:
[Sat Jan 20 08:03:11.177569 2018] [:error] [pid 3967:tid 140146487838464] [client 192.168.1.67:41784] rApache Notice! *** stack smashing detected ***: /usr/sbin/apache2 terminated [Sat Jan 20 08:03:11.932544 2018] [core:notice] [pid 24498:tid 140146758621056] AH00051: child pid 3967 exit signal Aborted (6), possible coredump in /etc/apache2
from rapache.
@alexvpickering I have never seen this stack smashing detected error. If you can reproduce it you can open a separate issue.
from rapache.
Related Issues (20)
- rApache on Centos 6.6 with apache 2.4 HOT 22
- Broken links HOT 1
- microsoft r open HOT 2
- Rapache is not able to fetch the request when RGoogleAnalytics package is used
- exceptions in RSourceOnStartup are not logged or sent to stderr HOT 1
- Process or memory? HOT 2
- Update RPM spec file version to latest (1.2.8) HOT 8
- Installing RApache in Ubuntu 16.04 Apache/2.4.18 (Ubuntu): I get some errors HOT 4
- How do you install additional packages?
- Ability to kill the apache process from an R script? HOT 4
- Setting UTF-8 HOT 2
- Integer overflow for posts over 1GB HOT 8
- Question: concurrent requests? HOT 2
- rApache notice! *** stack smashing detected *** with mailR::send_mail
- Rsource and RreqHandler not supported? HOT 1
- Your website www.rapache.net has been hacked HOT 2
- Installation error HOT 1
- RInfo handler not working on R version 4.1.1 (2021-08-10)
- arm64 compilation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rapache.