You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kaare Rasmussen <ka...@kakidata.dk> on 2002/09/24 09:44:29 UTC

Session support

I'm trying to set up session support for Embperl. 

I'd like to use Postgres, so my application can scale better. But it seems 
that it uses semaphores for locking, and that the semaphores is placed on 
Apache's side. Wouldn't this prevent me from using two or more Apache 
servers from runing the same application with one database server? 

But my current question is that I get a strange error. After fighting off 
semaphore and other problems, I'm stuck with this: 

[2811]ERR: 24: Error in Perl code: DBD::Pg::st execute failed: ERROR: 
Unterminated quoted string at 
/usr/lib/perl5/site_perl/5.6.1/Apache/Session/Store/DBI.pm line 42. 


Apache/1.3.26 (Unix) Embperl/2.0b8 PHP/4.2.2 mod_perl/1.27 [Mon Sep 23 
22:32:28 2002] 


Line 42 in DBI.pm is an execute of an insert into the sessions table. Can 
anyone help me or offer any hints? 

 --
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Web:      www.suse.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Email:kar@kakidata.dk 

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Session support

Posted by Angus Lees <gu...@inodes.org>.
At Sat, 28 Sep 2002 12:32:37 +0200, Kaare Rasmussen wrote:
> But another thing re sessions. I'm thinking about adding an "updated" column 
> and a trigger or something to be able to clean out old unused sessions.
> 
> Or does Apache::Session(X) magically keep track of them?

no, and its actually a feature i'd like Apache::SessionX to do somehow.

especially for dbm, where there is no way to add a "last accessed
time" for each entry.


note that you really want "last accessed time", not "last modified
time" if thats possible (it mightn't be).

-- 
 - Gus

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Session support

Posted by Gerald Richter <ri...@ecos.de>.
>
> But another thing re sessions. I'm thinking about adding an "updated"
column
> and a trigger or something to be able to clean out old unused sessions.
>
> Or does Apache::Session(X) magically keep track of them?
>

Not yet, also I would like to see the Apache::SessionX does keep track of
update and last access times to be able to cleanup old sessions. In my
developement version here I have already some code for iterating over all
session, which could be handy for expiring old sessions.

If anybody likes to add these times to Apache::SessionX I would be happy to
give some advice how to start...

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Session support

Posted by Kaare Rasmussen <ka...@kakidata.dk>.
> note that the latest version or two of DBD::Pg actually reports
> correct SQL types to DBI (which is probably why my DBIx::Recordset
> tests are failing now) and correctly escapes the binary BYTEA type.

OK, so I will try a bytea column with Storable. I don't think there will be a 
big performance win, but I'd like to know that the installation is optimal.

But another thing re sessions. I'm thinking about adding an "updated" column 
and a trigger or something to be able to clean out old unused sessions.

Or does Apache::Session(X) magically keep track of them?

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Email: kar@kakidata.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Web:      www.suse.dk

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Session support

Posted by Angus Lees <gu...@inodes.org>.
At Sat, 28 Sep 2002 05:27:32 +0200, Gerald Richter wrote:
> > Not sure what is the best for serialization. Bas64, Dumper, ...??
> > I haven't been able to find any discussion about pro / con for this.
> 
> As far as I know you should use Base64 for Postgres

note that the latest version or two of DBD::Pg actually reports
correct SQL types to DBI (which is probably why my DBIx::Recordset
tests are failing now) and correctly escapes the binary BYTEA type.

so you can probably (untested) use a BYTEA column for your binary
session data (which comes from Storable) and it will Just Work.

(previous versions of DBD::Pg and postgres couldn't cope with 8bit
data, hence the Base64 step)

-- 
 - Gus  (happy to see DBD::Pg development pick up again)

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Session support

Posted by Gerald Richter <ri...@ecos.de>.
> 
> Not sure what is the best for serialization. Bas64, Dumper, ...??
> I haven't been able to find any discussion about pro / con for this.
> 

As far as I know you should use Base64 for Postgres

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Session support

Posted by Angus Lees <gu...@inodes.org>.
At Thu, 26 Sep 2002 16:15:10 +0200, Kaare Rasmussen wrote:
> Thanks. I got it to work with 
> Postgres Semaphore Base64

that will work, but you should be using "Postgres Null Base64"

> Not sure what is the best for serialization. Bas64, Dumper, ...??
> I haven't been able to find any discussion about pro / con for this.

Storable -> Base64 is the usual way for postgres.  I should think that
the time/size you gain in using Storable rather than Data::Dumper
probably outweighs the cost of the extra Base64 step.

-- 
 - Gus

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Session support

Posted by Kaare Rasmussen <ka...@kakidata.dk>.
> in there somewhere will be the actual SQL statement being used, which
> should give some clues as to whats going wrong.

Thanks. I got it to work with 

Postgres Semaphore Base64

Not sure what is the best for serialization. Bas64, Dumper, ...??
I haven't been able to find any discussion about pro / con for this.

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Email: kar@kakidata.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Web:      www.suse.dk

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Session support

Posted by Kaare Rasmussen <ka...@kakidata.dk>.
> Yes, but you don't need any locking for Postgres. Use the Null locker,
> Postgres itself takes care for data integrity. Then you can use it across
> multiple Apaches.

Thanks. I will try that out. 

> Which parameters do give to Apache::SessionX Makefile.PL ?

I found an old message about the same problem. I think the answer was to set 
the parameters to Postgres Semaphore Base64. I got it to work, but I will 
try it out with Null instead of Semaphore. 

Not sure about Base64. Is this the best setting? 

 --
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Web:      www.suse.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Email:kar@kakidata.dk 

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Session support

Posted by Gerald Richter <ri...@ecos.de>.

> I'm trying to set up session support for Embperl.
>
> I'd like to use Postgres, so my application can scale better. But it seems
> that it uses semaphores for locking, and that the semaphores is placed on
> Apache's side. Wouldn't this prevent me from using two or more Apache
> servers from runing the same application with one database server?
>

Yes, but you don't need any locking for Postgres. Use the Null locker,
Postgres itself takes care for data integrity. Then you can use it across
multiple Apaches.

> But my current question is that I get a strange error. After fighting off
> semaphore and other problems, I'm stuck with this:
>
> [2811]ERR: 24: Error in Perl code: DBD::Pg::st execute failed: ERROR:
> Unterminated quoted string at
> /usr/lib/perl5/site_perl/5.6.1/Apache/Session/Store/DBI.pm line 42.
>
>

Which parameters do give to Apache::SessionX Makefile.PL ?

Does make test runs ok for Apache::SessionX?

Gerald




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Session support

Posted by Angus Lees <gu...@inodes.org>.
At Tue, 24 Sep 2002 07:44:29 GMT, Kaare Rasmussen wrote:
> I'm trying to set up session support for Embperl. 
> I'd like to use Postgres, so my application can scale better. But it seems 
> that it uses semaphores for locking, and that the semaphores is placed on 
> Apache's side. Wouldn't this prevent me from using two or more Apache 
> servers from runing the same application with one database server? 

yes it would, if you were using something other than postgres for
storage.

you should use the "Null" locker for postgres, since the postgres
store does its own locking (using postgres transactions).

> But my current question is that I get a strange error. After fighting off 
> semaphore and other problems, I'm stuck with this: 
> 
> [2811]ERR: 24: Error in Perl code: DBD::Pg::st execute failed: ERROR: 
> Unterminated quoted string at 
> /usr/lib/perl5/site_perl/5.6.1/Apache/Session/Store/DBI.pm line 42. 
> Line 42 in DBI.pm is an execute of an insert into the sessions table. Can 
> anyone help me or offer any hints? 

set the DBI_TRACE environment variable to /tmp/dbi.log (or something),
then start apache.  all DBI calls should now log several lines to that
log file.

in there somewhere will be the actual SQL statement being used, which
should give some clues as to whats going wrong.

-- 
 - Gus

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org