pl/R problem
Hi list,
Information first:
gds2=# select version();
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 8.1.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
20030502 (Red Hat Linux 3.2.3-20)
(1 row)
pl/R 0.6.2
R.2.3 (compiled from source)
R_HOME is defined (before starting postmaster)
gds2=# select * from pg_language;
lanname | lanispl | lanpltrusted | lanplcallfoid | lanvalidator | lanacl
-----------+---------+--------------+---------------+--------------+--------
internal | f | f | 0 | 2246 |
c | f | f | 0 | 2247 |
sql | f | t | 0 | 2248 |
plpgsql | t | t | 16393 | 16394 |
plperl | t | t | 18064 | 18065 |
plpythonu | t | f | 18067 | 0 |
plperlu | t | f | 18064 | 18065 |
plr | t | f | 24576 | 0 |
Now, for the problem:
gds2=# create function sd(_float8) returns float as '' language 'plr';
CREATE FUNCTION
gds2=# select round(sd('{1.23,1.31,1.42,1.27}'::_float8)::numeric,8);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
Relevant server log piece:
cannot find system Renviron
Fatal error: unable to open the base package
LOG: server process (PID 6792) exited with exit code 2
So, the question: what am I missing that enables it to find the "Renviron"
Thank you.
Don
On Tue, Aug 22, 2006 at 04:24:46PM -0500, Don Isgitt wrote:
gds2=# create function sd(_float8) returns float as '' language 'plr';
CREATE FUNCTIONgds2=# select round(sd('{1.23,1.31,1.42,1.27}'::_float8)::numeric,8);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.Relevant server log piece:
cannot find system Renviron
Fatal error: unable to open the base packageLOG: server process (PID 6792) exited with exit code 2
I can reproduce this on Solaris 9 with PL/R 0.6.2-alpha and R 2.2.1
if I rename $R_HOME/etc/Renviron to something else. I don't get
the "unable to open the base package" error but I do get "cannot
find system Renviron" and several other errors like "Error in
options(...) : invalid editor parameter" followed by a segmentation
fault.
So, the question: what am I missing that enables it to find the "Renviron"
Does the file $R_HOME/etc/Renviron or $R_HOME/etc/<architecture>/Renviron
exist and have permissions such that the PostgreSQL server can read
it? The error "cannot find system Renviron" comes from the R
function process_system_Renviron() in src/main/Renviron.c in response
to process_Renviron() returning 0, which it does if its filename
argument is NULL or if it can't open that file.
--
Michael Fuhr
Michael Fuhr wrote:
On Tue, Aug 22, 2006 at 04:24:46PM -0500, Don Isgitt wrote:
gds2=# create function sd(_float8) returns float as '' language 'plr';
CREATE FUNCTIONgds2=# select round(sd('{1.23,1.31,1.42,1.27}'::_float8)::numeric,8);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.Relevant server log piece:
cannot find system Renviron
Fatal error: unable to open the base packageLOG: server process (PID 6792) exited with exit code 2
I can reproduce this on Solaris 9 with PL/R 0.6.2-alpha and R 2.2.1
if I rename $R_HOME/etc/Renviron to something else. I don't get
the "unable to open the base package" error but I do get "cannot
find system Renviron" and several other errors like "Error in
options(...) : invalid editor parameter" followed by a segmentation
fault.So, the question: what am I missing that enables it to find the "Renviron"
Does the file $R_HOME/etc/Renviron or $R_HOME/etc/<architecture>/Renviron
exist and have permissions such that the PostgreSQL server can read
it? The error "cannot find system Renviron" comes from the R
function process_system_Renviron() in src/main/Renviron.c in response
to process_Renviron() returning 0, which it does if its filename
argument is NULL or if it can't open that file.
Hi Michael,
Thanks for the reply and the research. The relevant file is
[djisgitt@prs1 R-2.3.0]$ ls -l $R_HOME/etc/Renviron
-rw-rw-r-- 1 djisgitt djisgitt 1151 Jun 1 11:42
/home/djisgitt/R-2.3.0/etc/Renviron
so I don't see that as the problem.
I use R quite a lot, so I know the installation of R itself is good, but
this is the first time I have tried pl/R. Also, pgsql works, so I assume
there is something incorrect between pgsql and R. I just don't know what!
If you have any more suggestions, or need more information, let me know.
Don
Don Isgitt wrote:
Thanks for the reply and the research. The relevant file is
[djisgitt@prs1 R-2.3.0]$ ls -l $R_HOME/etc/Renviron
-rw-rw-r-- 1 djisgitt djisgitt 1151 Jun 1 11:42
/home/djisgitt/R-2.3.0/etc/Renvironso I don't see that as the problem.
I use R quite a lot, so I know the installation of R itself is good, but
this is the first time I have tried pl/R. Also, pgsql works, so I assume
there is something incorrect between pgsql and R. I just don't know what!If you have any more suggestions, or need more information, let me know.
I just got back from a business trip, and am trying to get caught up --
give me a few days and I'll see if I can help (i.e. I should be able to
find time on the weekend)...
Joe
On Wed, Aug 23, 2006 at 08:38:01AM -0500, Don Isgitt wrote:
Thanks for the reply and the research. The relevant file is
[djisgitt@prs1 R-2.3.0]$ ls -l $R_HOME/etc/Renviron
-rw-rw-r-- 1 djisgitt djisgitt 1151 Jun 1 11:42
/home/djisgitt/R-2.3.0/etc/Renvironso I don't see that as the problem.
Have you checked the permissions on all of the directories in the
file's path? Have you verified that PostgreSQL is using the same
$R_HOME? You can check the environment with plr_environ():
SELECT * FROM plr_environ() ORDER BY name;
--
Michael Fuhr
Adam Witney wrote:
Don Isgitt wrote:
Michael Fuhr wrote:
On Tue, Aug 22, 2006 at 04:24:46PM -0500, Don Isgitt wrote:
gds2=# create function sd(_float8) returns float as '' language 'plr';
CREATE FUNCTIONgds2=# select round(sd('{1.23,1.31,1.42,1.27}'::_float8)::numeric,8);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.Relevant server log piece:
cannot find system Renviron
Fatal error: unable to open the base packageLOG: server process (PID 6792) exited with exit code 2
I can reproduce this on Solaris 9 with PL/R 0.6.2-alpha and R 2.2.1
if I rename $R_HOME/etc/Renviron to something else. I don't get
the "unable to open the base package" error but I do get "cannot
find system Renviron" and several other errors like "Error in
options(...) : invalid editor parameter" followed by a segmentation
fault.So, the question: what am I missing that enables it to find the
"Renviron"Does the file $R_HOME/etc/Renviron or $R_HOME/etc/<architecture>/Renviron
exist and have permissions such that the PostgreSQL server can read
it? The error "cannot find system Renviron" comes from the R
function process_system_Renviron() in src/main/Renviron.c in response
to process_Renviron() returning 0, which it does if its filename
argument is NULL or if it can't open that file.Hi Michael,
Thanks for the reply and the research. The relevant file is
[djisgitt@prs1 R-2.3.0]$ ls -l $R_HOME/etc/Renviron
-rw-rw-r-- 1 djisgitt djisgitt 1151 Jun 1 11:42
/home/djisgitt/R-2.3.0/etc/Renvironso I don't see that as the problem.
I use R quite a lot, so I know the installation of R itself is good, but
this is the first time I have tried pl/R. Also, pgsql works, so I assume
there is something incorrect between pgsql and R. I just don't know what!If you have any more suggestions, or need more information, let me know.
Hi Don,
your functions work fine on my linux system. Just wondering, could the
fact that your R_HOME is installed under your home directory be causing
the problem? Postgesql will be running as a different user...adam
Hi Adam,
Thanks for checking that. There is world read access to R_HOME, so I
hope that is sufficient.
Don
Import Notes
Reply to msg id not found: 44EC5EB1.8010002@sgul.ac.uk
Michael Fuhr wrote:
On Wed, Aug 23, 2006 at 08:38:01AM -0500, Don Isgitt wrote:
Thanks for the reply and the research. The relevant file is
[djisgitt@prs1 R-2.3.0]$ ls -l $R_HOME/etc/Renviron
-rw-rw-r-- 1 djisgitt djisgitt 1151 Jun 1 11:42
/home/djisgitt/R-2.3.0/etc/Renvironso I don't see that as the problem.
Have you checked the permissions on all of the directories in the
file's path? Have you verified that PostgreSQL is using the same
$R_HOME? You can check the environment with plr_environ():
Yes. At least world read all the way.
gds2=# select * from plr_environ() order by name;
R_HOME | /home/djisgitt/R-2.3.0
SELECT * FROM plr_environ() ORDER BY name;
Thank you, Michael. I appreciate your help.
Don
Don Isgitt wrote:
Michael Fuhr wrote:
On Wed, Aug 23, 2006 at 08:38:01AM -0500, Don Isgitt wrote:
Thanks for the reply and the research. The relevant file is
[djisgitt@prs1 R-2.3.0]$ ls -l $R_HOME/etc/Renviron
-rw-rw-r-- 1 djisgitt djisgitt 1151 Jun 1 11:42
/home/djisgitt/R-2.3.0/etc/Renvironso I don't see that as the problem.
Have you checked the permissions on all of the directories in the
file's path? Have you verified that PostgreSQL is using the same
$R_HOME? You can check the environment with plr_environ():Yes. At least world read all the way.
The best way to make sure this is the case I've found is
su - postgres
stat /home/djisgitt/R-2.3.0/etc/Renviron
(or ls, whatever)
I've seen people swearing they have world access all the way and then
noticing they are missing a little bit somewhere.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
On Wed, Aug 23, 2006 at 09:37:17AM -0500, Don Isgitt wrote:
Michael Fuhr wrote:
Have you checked the permissions on all of the directories in the
file's path? Have you verified that PostgreSQL is using the same
$R_HOME? You can check the environment with plr_environ():Yes. At least world read all the way.
Just readable or also executable? What's the output of the following?
ls -ld /home/djisgitt/R-2.3.0/etc /home/djisgitt/R-2.3.0 /home/djisgitt /home
--
Michael Fuhr
Alvaro Herrera wrote:
Don Isgitt wrote:
Michael Fuhr wrote:
On Wed, Aug 23, 2006 at 08:38:01AM -0500, Don Isgitt wrote:
Thanks for the reply and the research. The relevant file is
[djisgitt@prs1 R-2.3.0]$ ls -l $R_HOME/etc/Renviron
-rw-rw-r-- 1 djisgitt djisgitt 1151 Jun 1 11:42
/home/djisgitt/R-2.3.0/etc/Renvironso I don't see that as the problem.
Have you checked the permissions on all of the directories in the
file's path? Have you verified that PostgreSQL is using the same
$R_HOME? You can check the environment with plr_environ():Yes. At least world read all the way.
The best way to make sure this is the case I've found is
su - postgres
stat /home/djisgitt/R-2.3.0/etc/Renviron
(or ls, whatever)I've seen people swearing they have world access all the way and then
noticing they are missing a little bit somewhere.
Quite so, Alvaro & Michael. Yes, world read as I said, but missing
execute at one level. Sorry for my carelessness. It works as expected now.
Thank you,
Don
Don Isgitt wrote:
Quite so, Alvaro & Michael. Yes, world read as I said, but missing
execute at one level. Sorry for my carelessness. It works as expected now.
Ah, good to know. I'll add myself a todo to eliminate the crash in this
scenario. I will include a fix in the next release, which will probably
be sometime after postgres 8.2 beta starts.
Joe