Re: Apache::SharedMem

2002-10-06 Thread Perrin Harkins

[EMAIL PROTECTED] wrote:
> We are using IPC::MM and it works great.

IPC::MM is the fastest game in town.  It's only drawback is that the 
data is not persistent, so if you want your cache to persist across 
restarts it won't work for you.

Apache::SharedMem and all the other modules based IPC::ShareLite or 
IPC::Shareable are slow.  If IPC::MM won't work for you, I'd suggest 
MLDBM::Sync, Cache::FileCache, or Cache::Mmap.

- Perrin




Re: Apache::SharedMem

2002-10-05 Thread siberian

We are using IPC::MM and it works great. We use it to 
cache about 5000 strings for our internationlized systems 
( EFIGS-J right now, going to 15 languages soon ). Its 
pretty easy, in our startup handler we have :

my $MM_SIZE = 500;
my $MM_FILE = 'st_cache_mm_file';
my $st_cache_mm = IPC::MM::mm_create($MM_SIZE, $MM_FILE);
my $st_cache_btree = 
IPC::MM::mm_make_btree_table($st_cache_mm);
tie %CACHE::mmcache, 'IPC::MM::BTree', $st_cache_btree;

Then we access it via the $CACHE::mmcache variable by 
language ID/Message ID hashes.

The performance is pretty good, a huge huge improvement 
over direct to database calls. The way we have it 
configured is that each child calls a function per string. 
This function checkes the apache wide MM cache, if it 
doesn't find it then it grabs it from the DB and sticks it 
there for the next child to come along. We were using 'per 
child' caching but it was slow, expensive and gave page 
load speeds with a lot of variance ( .5-1.5 seconds for 
cache, 10 seconds for uncachced ). It was pretty nasty.

We are not really expiring our cache, we just HUP apache 
to re-initialize it since MM is local to the root apache 
process.

Your mileage may vary, ours is pretty good.

John

On Sat, 05 Oct 2002 15:40:05 -0300
  Cristóvão Dalla Costa <[EMAIL PROTECTED]> wrote:
>Does anyone have experience with Apache::SharedMem? I'd 
>like to use it to store an in-perl cache of a few 
>thousand database items, in order to decrease load, but I 
>noticed that it's version 0.09 and not updated in a year, 
>so I became a little suspicious. Any comments?
>
>Thanks.
>




Apache::SharedMem

2002-10-05 Thread Cristóvão Dalla Costa

Does anyone have experience with Apache::SharedMem? I'd like to use it 
to store an in-perl cache of a few thousand database items, in order to 
decrease load, but I noticed that it's version 0.09 and not updated in a 
year, so I became a little suspicious. Any comments?

Thanks.




RE: Apache::SharedMem 0.07 installation problem

2001-10-02 Thread Alexei Barantsev

Actually, it is strange.

bash$ echo $PWD
/home/barancev
bash$ perl -e 'print $ENV{PWD}'
bash$ perl -e 'print "Oops!\n" unless exists $ENV{PWD}'
Oops!
bash$

By the way, `env` command does not show PWD variable too.

Somebody khows what the reason can be?

Once again my system configuration is
bash$ uname -a
Linux dallas 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown

Looks like it is not mod_perl related topic, sorry for noise.

> -Original Message-
> From: Olivier Poitrey [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 02, 2001 1:05 PM
> To: [EMAIL PROTECTED]; Modperl List
> Subject: Re: Apache::SharedMem 0.07 installation problem
> 
> 
> Ok, the test failed because your $ENV{PWD} is empty, I'll trap 
> this error on
> 0.08. By the way,
> why is your $ENV{PWD} empty ?
> 
> regards
> 
> --
> __
> _
>  O  l  i  v  i  e  rP  o  i  t  r  e  y
> 
> USA disaster support http://www.osdn.com/911.shtml*
> 
> - Original Message -
> From: "Alexei Barantsev" <[EMAIL PROTECTED]>
> To: "Olivier Poitrey" <[EMAIL PROTECTED]>; "Modperl List"
> <[EMAIL PROTECTED]>
> Sent: Tuesday, October 02, 2001 10:50 AM
> Subject: RE: Apache::SharedMem 0.07 installation problem
> 
> 
> > Nothing, sir! :) The matter is that $ENV{PWD} is empty.
> >
> > Neither works this one:
> > $ perl -MIPC::SysV -e 'print IPC::SysV::ftok(`pwd`, $<), "\n"'
> >
> > This variant works though:
> > $ perl -MIPC::SysV -e 'chomp($pwd = `pwd`); print IPC::SysV::ftok($pwd,
> $<),
> > "\n"'
> > -1760399103
> >




Re: Apache::SharedMem 0.07 installation problem

2001-10-02 Thread Olivier Poitrey

Ok, the test failed because your $ENV{PWD} is empty, I'll trap this error on
0.08. By the way,
why is your $ENV{PWD} empty ?

regards

--
___
 O  l  i  v  i  e  rP  o  i  t  r  e  y

USA disaster support http://www.osdn.com/911.shtml*

- Original Message -
From: "Alexei Barantsev" <[EMAIL PROTECTED]>
To: "Olivier Poitrey" <[EMAIL PROTECTED]>; "Modperl List"
<[EMAIL PROTECTED]>
Sent: Tuesday, October 02, 2001 10:50 AM
Subject: RE: Apache::SharedMem 0.07 installation problem


> Nothing, sir! :) The matter is that $ENV{PWD} is empty.
>
> Neither works this one:
> $ perl -MIPC::SysV -e 'print IPC::SysV::ftok(`pwd`, $<), "\n"'
>
> This variant works though:
> $ perl -MIPC::SysV -e 'chomp($pwd = `pwd`); print IPC::SysV::ftok($pwd,
$<),
> "\n"'
> -1760399103
>
> > -Original Message-
> > From: Olivier Poitrey [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, October 02, 2001 12:24 PM
> > To: [EMAIL PROTECTED]; Modperl List
> > Subject: Re: Apache::SharedMem 0.07 installation problem
> >
> >
> > What this command return on your system:
> >
> > $ perl -MIPC::SysV -e 'print IPC::SysV::ftok($ENV{PWD}, $<), "\n"'
> >
> > best regards
> >
> > --
> > __
> > _
> >  O  l  i  v  i  e  rP  o  i  t  r  e  y
> >
> > USA disaster support http://www.osdn.com/911.shtml
> >
> > - Original Message -
> > From: "Alexei Barantsev" <[EMAIL PROTECTED]>
> > To: "Modperl List" <[EMAIL PROTECTED]>
> > Sent: Tuesday, October 02, 2001 8:32 AM
> > Subject: Apache::SharedMem 0.07 installation problem
> >
> >
> > > I have problems with Apache::SharedMem 0.07 installation.
> > >
> > > Here is my configuration:
> > >
> > >   bash$ uname -a
> > >   Linux dallas 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown
> > >
> > >   bash$ perl -v
> > >   This is perl, v5.6.1 built for i686-linux
> > >
> > > And here is 'make test' report:
> > >
> > > bash$ make test TEST_VERBOSE=1
> > > PERL_DL_NONLAZY=1
> > >
> > /usr/bin/perl5.00503 -Iblib/arch -Iblib/lib
> > -I/usr/lib/perl5/5.00503/i386-li
> > > nux -I/usr/lib/perl5/5.005
> > > 03 -e 'use Test::Harness qw(&runtests $verbose); $verbose=1; runtests
> > > @ARGV;' t/*.t
> > > t/assign..1..8
> > > ok 1
> > > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> > > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> > > Apache::SharedMem object creation missing rootkey parameter. at
> > t/assign.t
> > > line 14
> > > dubious
> > > Test returned status 2 (wstat 512, 0x200)
> > > DIED. FAILED tests 2-8
> > > Failed 7/8 tests, 12.50% okay
> > > t/import..1..5
> > > ok 1
> > > ok 2
> > > ok 3
> > > ok 4
> > > ok 5
> > > ok
> > > t/smartlock...1..16
> > > ok 1
> > > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> > > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> > > Apache::SharedMem object creation missing rootkey parameter. at
> > > t/smartlock.t line 14
> > > dubious
> > > Test returned status 2 (wstat 512, 0x200)
> > > DIED. FAILED tests 2-16
> > > Failed 15/16 tests, 6.25% okay
> > > t/timedoutlock1..8
> > > ok 1
> > > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> > > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> > > Apache::SharedMem object creation missing rootkey parameter. at
> > > t/timedoutlock.t line 14
> > > dubious
> > > Test returned status 2 (wstat 512, 0x200)
> > > DIED. FAILED tests 2-8
> > > Failed 7/8 tests, 12.50% okay
> > > t/zdestroy1..3
> > > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> > > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> > > Apache::SharedMem object creation missing rootkey parameter. at
> > t/zdestroy.t
> > > line 14
> > > dubious
> > > Test returned status 2 (wstat 512, 0x200)
> > > DIED. FAILED tests 1-3
> > > Failed 3/3 tests, 0.00% okay
> > > Failed Test  Stat Wstat Total Fail  Failed  List of Failed
> > >
>
> --
> > --
> > > ---
> > > t/assign.t  2   512 87  87.50%  2-8
> > > t/smartlock.t   2   51216   15  93.75%  2-16
> > > t/timedoutlock.t2   512 87  87.50%  2-8
> > > t/zdestroy.t2   512 33 100.00%  1-3
> > > Failed 4/5 test scripts, 20.00% okay. 32/40 subtests failed,
> > 20.00% okay.
> > > make: *** [test_dynamic] Error 2
> > >
> > > --
> > > Alexei Barantsev, ISP RAS
> > > E-mail: [EMAIL PROTECTED]
> > > ICQ   : 3959207
> > >
> > >
> >
>
>




RE: Apache::SharedMem 0.07 installation problem

2001-10-02 Thread Alexei Barantsev

Nothing, sir! :) The matter is that $ENV{PWD} is empty.

Neither works this one:
$ perl -MIPC::SysV -e 'print IPC::SysV::ftok(`pwd`, $<), "\n"'

This variant works though:
$ perl -MIPC::SysV -e 'chomp($pwd = `pwd`); print IPC::SysV::ftok($pwd, $<),
"\n"'
-1760399103

> -Original Message-
> From: Olivier Poitrey [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 02, 2001 12:24 PM
> To: [EMAIL PROTECTED]; Modperl List
> Subject: Re: Apache::SharedMem 0.07 installation problem
>
>
> What this command return on your system:
>
> $ perl -MIPC::SysV -e 'print IPC::SysV::ftok($ENV{PWD}, $<), "\n"'
>
> best regards
>
> --
> __
> _
>  O  l  i  v  i  e  rP  o  i  t  r  e  y
>
> USA disaster support http://www.osdn.com/911.shtml
>
> - Original Message -
> From: "Alexei Barantsev" <[EMAIL PROTECTED]>
> To: "Modperl List" <[EMAIL PROTECTED]>
> Sent: Tuesday, October 02, 2001 8:32 AM
> Subject: Apache::SharedMem 0.07 installation problem
>
>
> > I have problems with Apache::SharedMem 0.07 installation.
> >
> > Here is my configuration:
> >
> >   bash$ uname -a
> >   Linux dallas 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown
> >
> >   bash$ perl -v
> >   This is perl, v5.6.1 built for i686-linux
> >
> > And here is 'make test' report:
> >
> > bash$ make test TEST_VERBOSE=1
> > PERL_DL_NONLAZY=1
> >
> /usr/bin/perl5.00503 -Iblib/arch -Iblib/lib
> -I/usr/lib/perl5/5.00503/i386-li
> > nux -I/usr/lib/perl5/5.005
> > 03 -e 'use Test::Harness qw(&runtests $verbose); $verbose=1; runtests
> > @ARGV;' t/*.t
> > t/assign..1..8
> > ok 1
> > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> > Apache::SharedMem object creation missing rootkey parameter. at
> t/assign.t
> > line 14
> > dubious
> > Test returned status 2 (wstat 512, 0x200)
> > DIED. FAILED tests 2-8
> > Failed 7/8 tests, 12.50% okay
> > t/import..1..5
> > ok 1
> > ok 2
> > ok 3
> > ok 4
> > ok 5
> > ok
> > t/smartlock...1..16
> > ok 1
> > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> > Apache::SharedMem object creation missing rootkey parameter. at
> > t/smartlock.t line 14
> > dubious
> > Test returned status 2 (wstat 512, 0x200)
> > DIED. FAILED tests 2-16
> > Failed 15/16 tests, 6.25% okay
> > t/timedoutlock1..8
> > ok 1
> > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> > Apache::SharedMem object creation missing rootkey parameter. at
> > t/timedoutlock.t line 14
> > dubious
> > Test returned status 2 (wstat 512, 0x200)
> > DIED. FAILED tests 2-8
> > Failed 7/8 tests, 12.50% okay
> > t/zdestroy1..3
> > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> > Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> > Apache::SharedMem object creation missing rootkey parameter. at
> t/zdestroy.t
> > line 14
> > dubious
> > Test returned status 2 (wstat 512, 0x200)
> > DIED. FAILED tests 1-3
> > Failed 3/3 tests, 0.00% okay
> > Failed Test  Stat Wstat Total Fail  Failed  List of Failed
> >
> --
> --
> > ---
> > t/assign.t  2   512 87  87.50%  2-8
> > t/smartlock.t   2   51216   15  93.75%  2-16
> > t/timedoutlock.t2   512 87  87.50%  2-8
> > t/zdestroy.t2   512 33 100.00%  1-3
> > Failed 4/5 test scripts, 20.00% okay. 32/40 subtests failed,
> 20.00% okay.
> > make: *** [test_dynamic] Error 2
> >
> > --
> > Alexei Barantsev, ISP RAS
> > E-mail: [EMAIL PROTECTED]
> > ICQ   : 3959207
> >
> >
>




Re: Apache::SharedMem 0.07 installation problem

2001-10-02 Thread Olivier Poitrey

What this command return on your system:

$ perl -MIPC::SysV -e 'print IPC::SysV::ftok($ENV{PWD}, $<), "\n"'

best regards

--
___
 O  l  i  v  i  e  rP  o  i  t  r  e  y

USA disaster support http://www.osdn.com/911.shtml

- Original Message -
From: "Alexei Barantsev" <[EMAIL PROTECTED]>
To: "Modperl List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 02, 2001 8:32 AM
Subject: Apache::SharedMem 0.07 installation problem


> I have problems with Apache::SharedMem 0.07 installation.
>
> Here is my configuration:
>
>   bash$ uname -a
>   Linux dallas 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown
>
>   bash$ perl -v
>   This is perl, v5.6.1 built for i686-linux
>
> And here is 'make test' report:
>
> bash$ make test TEST_VERBOSE=1
> PERL_DL_NONLAZY=1
>
/usr/bin/perl5.00503 -Iblib/arch -Iblib/lib -I/usr/lib/perl5/5.00503/i386-li
> nux -I/usr/lib/perl5/5.005
> 03 -e 'use Test::Harness qw(&runtests $verbose); $verbose=1; runtests
> @ARGV;' t/*.t
> t/assign..1..8
> ok 1
> Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> Apache::SharedMem object creation missing rootkey parameter. at t/assign.t
> line 14
> dubious
> Test returned status 2 (wstat 512, 0x200)
> DIED. FAILED tests 2-8
> Failed 7/8 tests, 12.50% okay
> t/import..1..5
> ok 1
> ok 2
> ok 3
> ok 4
> ok 5
> ok
> t/smartlock...1..16
> ok 1
> Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> Apache::SharedMem object creation missing rootkey parameter. at
> t/smartlock.t line 14
> dubious
> Test returned status 2 (wstat 512, 0x200)
> DIED. FAILED tests 2-16
> Failed 15/16 tests, 6.25% okay
> t/timedoutlock1..8
> ok 1
> Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> Apache::SharedMem object creation missing rootkey parameter. at
> t/timedoutlock.t line 14
> dubious
> Test returned status 2 (wstat 512, 0x200)
> DIED. FAILED tests 2-8
> Failed 7/8 tests, 12.50% okay
> t/zdestroy1..3
> Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
> Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
> Apache::SharedMem object creation missing rootkey parameter. at
t/zdestroy.t
> line 14
> dubious
> Test returned status 2 (wstat 512, 0x200)
> DIED. FAILED tests 1-3
> Failed 3/3 tests, 0.00% okay
> Failed Test  Stat Wstat Total Fail  Failed  List of Failed
> --
--
> ---
> t/assign.t  2   512 87  87.50%  2-8
> t/smartlock.t   2   51216   15  93.75%  2-16
> t/timedoutlock.t2   512 87  87.50%  2-8
> t/zdestroy.t2   512 33 100.00%  1-3
> Failed 4/5 test scripts, 20.00% okay. 32/40 subtests failed, 20.00% okay.
> make: *** [test_dynamic] Error 2
>
> --
> Alexei Barantsev, ISP RAS
> E-mail: [EMAIL PROTECTED]
> ICQ   : 3959207
>
>




Apache::SharedMem 0.07 installation problem

2001-10-01 Thread Alexei Barantsev

I have problems with Apache::SharedMem 0.07 installation.

Here is my configuration:

  bash$ uname -a
  Linux dallas 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown

  bash$ perl -v
  This is perl, v5.6.1 built for i686-linux

And here is 'make test' report:

bash$ make test TEST_VERBOSE=1
PERL_DL_NONLAZY=1
/usr/bin/perl5.00503 -Iblib/arch -Iblib/lib -I/usr/lib/perl5/5.00503/i386-li
nux -I/usr/lib/perl5/5.005
03 -e 'use Test::Harness qw(&runtests $verbose); $verbose=1; runtests
@ARGV;' t/*.t
t/assign..1..8
ok 1
Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
Apache::SharedMem object creation missing rootkey parameter. at t/assign.t
line 14
dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 2-8
Failed 7/8 tests, 12.50% okay
t/import..1..5
ok 1
ok 2
ok 3
ok 4
ok 5
ok
t/smartlock...1..16
ok 1
Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
Apache::SharedMem object creation missing rootkey parameter. at
t/smartlock.t line 14
dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 2-16
Failed 15/16 tests, 6.25% okay
t/timedoutlock1..8
ok 1
Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
Apache::SharedMem object creation missing rootkey parameter. at
t/timedoutlock.t line 14
dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 2-8
Failed 7/8 tests, 12.50% okay
t/zdestroy1..3
Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1073.
Use of uninitialized value at blib/lib/Apache/SharedMem.pm line 1075.
Apache::SharedMem object creation missing rootkey parameter. at t/zdestroy.t
line 14
dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-3
Failed 3/3 tests, 0.00% okay
Failed Test  Stat Wstat Total Fail  Failed  List of Failed

---
t/assign.t  2   512 87  87.50%  2-8
t/smartlock.t   2   51216   15  93.75%  2-16
t/timedoutlock.t2   512 87  87.50%  2-8
t/zdestroy.t2   512 33 100.00%  1-3
Failed 4/5 test scripts, 20.00% okay. 32/40 subtests failed, 20.00% okay.
make: *** [test_dynamic] Error 2

--
Alexei Barantsev, ISP RAS
E-mail: [EMAIL PROTECTED]
ICQ   : 3959207




Re: Problems with Apache::SharedMem

2001-07-05 Thread Olivier Poitrey

Clean your ipc segment keys (with ipcrm) or choose another rootname.
This probleme will be solve in a future version.

--
___
 O  l  i  v  i  e  rP  o  i  t  r  e  y
- Original Message -
From: "Alberto Canzi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 05, 2001 4:51 PM
Subject: Problems with Apache::SharedMem


> Hi I've tried to use Apache::SharedMem to share memory between
> subsequent requests' handlers, but I got this error messages:
>
>
>
> *******
>
> [Thu Jul  5 16:46:53 2001] [error] Apache::SharedMem object
> initialization: Unable to initialize root ipc shared memory segment:
> File exists at /usr/lib/perl5/site_perl/5.005/Apache/SharedMem.pm line
> 690
>  
> Apache::SharedMem::_init_root('Apache::SharedMem=HASH(0x85b8794)')
> called at /usr/lib/perl5/site_perl/5.005/Apache/SharedMem.pm line 707
>
> Apache::SharedMem::_init_namespace('Apache::SharedMem=HASH(0x85b8794)')
> called at /usr/lib/perl5/site_perl/5.005/Apache/SharedMem.pm line 142
> Apache::SharedMem::new('Apache::SharedMem') called at
> /usr/local/apache.max//Apache/O4AuthTool.pm line 65
>
> Apache::O4AuthTool::setGVar('Apache::O4AuthTool=HASH(0x85499d8)',
> 'PIPPO', '/') called at
> /usr/local/apache.max//Apache/O4AuthletHandler.pm line 39
> Apache::O4AuthletHandler::handler('Apache=SCALAR(0x85b86ec)')
> called at /dev/null line 0
> eval {...} called at /dev/null line 0
>
> *****
>
> What does it mean "File Exists" ?? Which file ???
>
> The source code is :
>
> *
>
>  sub getGVar {
> my($self,$varname) = @_;
>
> #my $share = new Apache::SharedMem(debug=>0, ipc_mode => '0777');
> my $share = new Apache::SharedMem();
>
>
> # ...in another process
> my $var;
> #die("can't get key: ", $self->error) unless($share->status eq
> SUCCESS);
>
> #$share->delete(key);
>
> #$share->clear if($share->size > $max_size);
>
> my $lock_timeout = 40; # seconds
> if($share->lock(LOCK_EX, $lock_timeout))
> {
> # $var = $share->get($varname, WAIT, 40);
> $var = $share->get("PIPPO", NOWAIT);
> my $st = $share->status;
> logga($self,"status = $st");
> if(!($share->status eq SUCCESS)){
> my $err= $share->error;
>logga($self,"FALLITA LA getGVar ($err)");
> $share->unlock;
> $share->release;
> return undef;
> }
> }else {
> logga($self,"fallita la lock...");
> }
> $share->unlock;
> $share->release;
> return $var;
>  }
>
>  sub setGVar {
> my($self,$varname, $varval) = @_;
>
> #my $share = new Apache::SharedMem( rootname => 'STRONZO', namespace
> => 'PD', debug=>1, ipc_mode => '0777');
> my $share = new Apache::SharedMem();
> my $ret = 0;
>
> #$share->set(key=>'some data');
>
> # ...in another process
> #my $var = $share->get(key, NOWAIT);
> #die("can't get key: ", $self->error) unless($share->status eq
> SUCCESS);
>
> #$share->delete(key);
>
> #$share->clear if($share->size > $max_size);
>
> my $lock_timeout = 40; # seconds
> if($share->lock(LOCK_EX, $lock_timeout))
> {
> # $share->set($varname => $varval);
> $share->set("PUPPO" => $varval);
> if($share->status eq FAILURE){
> my $err= $share->error;
>logga($self,"FALLITA LA setGVar $err");
> }
> if($share->status eq SUCCESS){
> my $err= $share->error;
>logga($self,"SUCCESSO LA setGVar $err");
> $ret = 1;
> }
> $share->unlock;
> }
> $share->release;
> return $ret;
>  }
>
> *
>
> I get errors when I call setGVar().
> Could someone help me?
>
> Many Thanks,
> Alberto
>
> --
> Alberto Canzi
> OpenFor s.r.l.
> e-mail: [EMAIL PROTECTED]
>
>





Problems with Apache::SharedMem

2001-07-05 Thread Alberto Canzi

Hi I've tried to use Apache::SharedMem to share memory between
subsequent requests' handlers, but I got this error messages:



***

[Thu Jul  5 16:46:53 2001] [error] Apache::SharedMem object
initialization: Unable to initialize root ipc shared memory segment:
File exists at /usr/lib/perl5/site_perl/5.005/Apache/SharedMem.pm line
690
    
Apache::SharedMem::_init_root('Apache::SharedMem=HASH(0x85b8794)')
called at /usr/lib/perl5/site_perl/5.005/Apache/SharedMem.pm line 707
   
Apache::SharedMem::_init_namespace('Apache::SharedMem=HASH(0x85b8794)')
called at /usr/lib/perl5/site_perl/5.005/Apache/SharedMem.pm line 142
    Apache::SharedMem::new('Apache::SharedMem') called at
/usr/local/apache.max//Apache/O4AuthTool.pm line 65
   
Apache::O4AuthTool::setGVar('Apache::O4AuthTool=HASH(0x85499d8)',
'PIPPO', '/') called at
/usr/local/apache.max//Apache/O4AuthletHandler.pm line 39
Apache::O4AuthletHandler::handler('Apache=SCALAR(0x85b86ec)')
called at /dev/null line 0
eval {...} called at /dev/null line 0 

*

What does it mean "File Exists" ?? Which file ???

The source code is :

*********

 sub getGVar {   
my($self,$varname) = @_;

#my $share = new Apache::SharedMem(debug=>0, ipc_mode => '0777');
my $share = new Apache::SharedMem();


# ...in another process
my $var;
#die("can't get key: ", $self->error) unless($share->status eq
SUCCESS);

#$share->delete(key);

#$share->clear if($share->size > $max_size);

my $lock_timeout = 40; # seconds
if($share->lock(LOCK_EX, $lock_timeout))
{
#   $var = $share->get($varname, WAIT, 40);
$var = $share->get("PIPPO", NOWAIT);
my $st = $share->status;
logga($self,"status = $st");
if(!($share->status eq SUCCESS)){
my $err= $share->error;
logga($self,"FALLITA LA getGVar ($err)");
$share->unlock;
$share->release;   
return undef;
}
}else {
    logga($self,"fallita la lock...");
}
$share->unlock;
$share->release; 
return $var;
 }

 sub setGVar {   
my($self,$varname, $varval) = @_;

#my $share = new Apache::SharedMem( rootname => 'STRONZO', namespace
=> 'PD', debug=>1, ipc_mode => '0777');
my $share = new Apache::SharedMem();
my $ret = 0;

#$share->set(key=>'some data');

# ...in another process
#my $var = $share->get(key, NOWAIT);
#die("can't get key: ", $self->error) unless($share->status eq
SUCCESS);

#$share->delete(key);

#$share->clear if($share->size > $max_size);

my $lock_timeout = 40; # seconds
if($share->lock(LOCK_EX, $lock_timeout))
{
#   $share->set($varname => $varval);
$share->set("PUPPO" => $varval);
if($share->status eq FAILURE){
my $err= $share->error;
logga($self,"FALLITA LA setGVar $err");
} 
if($share->status eq SUCCESS){
my $err= $share->error;
logga($self,"SUCCESSO LA setGVar $err");
$ret = 1;
}
$share->unlock;
}
$share->release;   
return $ret;
 }

*

I get errors when I call setGVar().
Could someone help me?

Many Thanks,
Alberto

-- 
Alberto Canzi
OpenFor s.r.l.
e-mail: [EMAIL PROTECTED]