You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by John Walstra <jo...@cnet.com> on 2000/09/18 21:16:19 UTC

Session errors

I've just run into the same problem. I get the premission denied error when
ever I use %udat.  Here is the information.

setup
----
Apache-Session-1.03
HTML-Embperl-1.2.1
mod_perl-1.24
apache_1.3.12

the startup
----
[jwalstra@www1 conf]$ ../bin/apachectl start
[5050]SES:  Embperl Session management enabled (1.xx)
../bin/apachectl start: httpd started

from my httpd.conf
----
PerlSetEnv EMBPERL_SESSION_CLASSES "DBIStore SysVSemaphoreLocker"
PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:sessions UserName=global Password=global"
PerlModule HTML::Embperl

command line access of sessions database
----
[jwalstra@www1 conf]$ mysql --user=global --password=global sessions
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35306 to server version: 3.22.22

Type 'help' for help.

mysql> explain sessions;
+-----------+-------------+------+-----+---------+-------+
| Field     | Type        | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| id        | varchar(32) |      | PRI |         |       |
| a_session | text        | YES  |     | NULL    |       |
+-----------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql>insert into sessions (a_session) values ('test');
Query OK, 1 row affected (0.00 sec)

mysql> delete from sessions where a_session='test';
Query OK, 1 row affected (0.00 sec)

my test app
-----------
[-
  $udat{message} = "HI";
-]

<html>
<head>
<title>test</title>
<head>
<body>
test
</body>
</html>

the error
---------
[5052]ERR: 24: Line 1: Error in Perl code: Permission denied at
/usr/lib/perl5/site_perl/5.005/Apache/Session/SysVSemaphoreLocker.pm line 63.


When I do an IPC, I get the following. 
----
[jwalstra@www1 public_html]$ ipcs

------ Shared Memory Segments --------
key       shmid     owner     perms     bytes     nattch    status      
0x05f42a8b 16257     daemon    666       34868     0                     
0x00000000 106376    jwalstra  600       46084     3         dest        

------ Semaphore Arrays --------
key       semid     owner     perms     nsems     status      
0x000d9479 0         daemon    666       1         
0x000d946e 1         daemon    666       1         

------ Message Queues --------
key       msqid     owner     perms     used-bytes  messages 
----

I've never used IPC before, so I'm not sure what the output is telling me. I do
know that the "jwalstra" is my apache, since when I shut down apache that line
disappears. The user and group for people connecting is the same as the user
and group of apache.

User  jwalstra
Group users

Well, that's about it for information that I think is usefull. 

Thanks,
John

>I've been having a lot of problems with sessions lately.  I'll run through
>everything I've done so far.
>
>I have currently downgraded my Apache::Session from 1.53 to 1.03 since I am
>running Embperl 1.2.1 with mod_perl 1.24.  In my original httpd.conf file I
>previously used:
>
>PerlSetEnv EMBPERL_SESSION_CLASSES "DBIStore SysVSemaphoreLocker"
>PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:sessions
UserName=username Password=password"
>However, if I use SysVSemaphoreLocker then I get this error when it tries
>to load a page from a browser.
>
[>27330]ERR: 24: Line 12: Error in Perl code: Permission denied at
>/usr/local/lib/perl5/site_perl/5.005/Apache/Session/SysVSemaphoreLocker.pm
>line 63.
>Apache/1.3.12 (Unix) mod_perl/1.24 HTML::Embperl 1.2.1 [Fri Sep 15 23:22:42
>2000]

-- 
John Walstra                                   CNET Networks / Apollo Solutions
Senior Software Developer                      300 Park Blvd, Suite 105
mailto:johnw@cnet.com                          Itasca, IL 60143-4914

Re: Session errors

Posted by Gerald Richter <ri...@ecos.de>.
> I have 3 RH 6.2 boxes where in 2 the Semaphore locking gives
> "permission denied" and in one it works.  The difference is that the
> one that works is running apache and mod_perl from rpm's and the 2
> that don't work have Apache and mod_perl compiled from source!  I
> wonder if this is the case with others that have semaphore problems.
>

This may occur when both run under different users

>
> I set:
>
> PerlSetEnv EMBPERL_SESSION_ARGS "Datasource=dbi:Pg:dbname=sessions
UserName=postgres"
>

Must be   DataSource

Sorry, this was spelling error in my previous mail. To get the exact
parameters that the Postgres store accpets, read:

perldoc Apache::Session::Store::Postgres


Gerald



Re: Session errors

Posted by Mikko Harjula <Mi...@sqc.fi>.
I have 3 RH 6.2 boxes where in 2 the Semaphore locking gives
"permission denied" and in one it works.  The difference is that the
one that works is running apache and mod_perl from rpm's and the 2
that don't work have Apache and mod_perl compiled from source!  I
wonder if this is the case with others that have semaphore problems.

> so use something like
> 
> PerlSetEnv EMBPERL_SESSION_CLASSES "Postgres Semaphore"
> 
> the EMBPERL_SESSION_ARGS must contain the database etc.
> 
> PerlSetEnv EMBPERL_SESSION_ARGS "Datasource=dbi:Pg:dbanme=foo UserName=bar
> Password=secret"

I set:

PerlSetEnv EMBPERL_SESSION_ARGS "Datasource=dbi:Pg:dbname=sessions UserName=postgres"

and

PerlSetEnv EMBPERL_SESSION_CLASSES "Postgres Null"

or

PerlSetEnv EMBPERL_SESSION_CLASSES "Postgres Semaphore"

I quess Null would be ok because postgres itself handles concurrency?
Anyway the result in both cases was:

[4881]SES:  Embperl Session management enabled (>= 1.50)

[Thu Sep 28 09:09:57 2000] [error] [4880]ERR: 24: Line 18: Error in
Perl code: Can't connect( postgres HASH(0x8349214)), no database
driver specified and DBI_DSN env var not set at
/usr/lib/perl5/site_perl/5.005/Apache/Session/Store/Postgres.pm line
49


I put some debug output in Apache/Session/Store/Postgres.pm and DBI.pm 
and it seems that the datasource gets lost somewhere.  In DBI.pm sub
connect:

DEBUG DBI.pm: dsn ='' user='postgres', pass=''

and in Postgres.pm sub connection:

DEBUG Postgres.pm: datasource='', username='postgres', password=''

I have a separate database for application data and that works OK.

Re: Session errors

Posted by Gerald Richter <ri...@ecos.de>.
>
> [Fri Sep 22 13:56:47 2000] [error] Cannot require
> Apache::Session::Lock::SysVSem aphoreLocker at
> /usr/lib/perl5/site_perl/5.005/i386-linux/HTML/Embperl/Session.pm
> line 204.
>

> However everything seems to work OK if I changed
>
> PerlSetEnv EMBPERL_SESSION_CLASSES "File SysVSemaphoreLocker"
>

for Apache::Session 1.5x this must be

PerlSetEnv EMBPERL_SESSION_CLASSES "File Semaphore"

due to a rename of the Apache::Session classes.

>
> in apache config.  I am storing sessions in a file because I run
> PostgreSQL instead of MySQL and I couldn't get session handling to
> work with postgresql.  Anyone knows how?
>

Apache::Session has a special module for using postgress:
Apache::Session::Store::Postgres

so use something like

PerlSetEnv EMBPERL_SESSION_CLASSES "Postgres Semaphore"

the EMBPERL_SESSION_ARGS must contain the database etc.

PerlSetEnv EMBPERL_SESSION_ARGS "Datasource=dbi:Pg:dbanme=foo UserName=bar
Password=secret"


Gerald





Re: Session errors

Posted by Mikko Harjula <Mi...@sqc.fi>.
> > ------ Semaphore Arrays --------
> > key       semid     owner     perms     nsems     status
> > 0x000d9479 0         daemon    666       1
> > 0x000d946e 1         daemon    666       1
> >
> 
> The nsems values must be higher for Apache::Session (>=8). I am not an IPC
> guru, but if you are on a test system, I would try to use ipcrm to delete
> these both semaphores. I guess one of them is in the way. Then
> Apache::Session can recreate his semaphore. If this is not a test system, be
> carefull not to delete a semaphore that is needed by another process

I have the same problem.  I stopped all servers (apache and postgres), 
deleted all semaphores and shared memory segments and restarted the
servers.  Now I get in apache logs:

[Fri Sep 22 13:56:47 2000] [error] Cannot require
Apache::Session::Lock::SysVSem aphoreLocker at
/usr/lib/perl5/site_perl/5.005/i386-linux/HTML/Embperl/Session.pm
line 204.

[Fri Sep 22 13:56:47 2000] [error] Cannot require
Apache::Session::Lock::SysVSem aphoreLocker at
/usr/lib/perl5/site_perl/5.005/i386-linux/HTML/Embperl/Session.pm
line 204.

[Fri Sep 22 13:56:47 2000] [error] Can't locate
auto/HTML/Embperl/ScanEnviron.al
 in @INC (@INC contains: /usr/lib/perl5/5.00503/i386-linux
/usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005 . /usr/local/apache/
/usr/local/apache/lib/perl) at /usr/lib/perl5/site_perl/5.005/i3
86-linux/HTML/Embperl.pm line 1222

[Fri Sep 22 13:56:47 2000] [error] Can't locate
auto/HTML/Embperl/ScanEnviron.al
 in @INC (@INC contains: /usr/lib/perl5/5.00503/i386-linux
/usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005 . /usr/local/apache/
/usr/local/apache/lib/perl) at /usr/lib/perl5/site_perl/5.005/i3
86-linux/HTML/Embperl.pm line 1222

However everything seems to work OK if I changed

PerlSetEnv EMBPERL_SESSION_CLASSES "File SysVSemaphoreLocker"

into

PerlSetEnv EMBPERL_SESSION_CLASSES "File File"

in apache config.  I am storing sessions in a file because I run
PostgreSQL instead of MySQL and I couldn't get session handling to
work with postgresql.  Anyone knows how?

My config is

Red Hat Linux release 6.2
Linux kernel 2.2.14-5.0
Server version: Apache/1.3.12 (Unix)
mod_perl-1.24
Apache-Session-1.53
DBD-Pg-0.95
DBI-1.14
HTML-Embperl-1.3b5

Re: Session errors

Posted by Gerald Richter <ri...@ecos.de>.
> [5052]ERR: 24: Line 1: Error in Perl code: Permission denied at
> /usr/lib/perl5/site_perl/5.005/Apache/Session/SysVSemaphoreLocker.pm line
63.
>
>
This is because Apache::Session cannot create/open the semaphore

> ------ Semaphore Arrays --------
> key       semid     owner     perms     nsems     status
> 0x000d9479 0         daemon    666       1
> 0x000d946e 1         daemon    666       1
>

The nsems values must be higher for Apache::Session (>=8). I am not an IPC
guru, but if you are on a test system, I would try to use ipcrm to delete
these both semaphores. I guess one of them is in the way. Then
Apache::Session can recreate his semaphore. If this is not a test system, be
carefull not to delete a semaphore that is needed by another process

Gerald