You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Raul Dias <ra...@dias.com.br> on 2003/12/29 20:36:04 UTC
[MP2] Storable/Cache trobles with MM worker?
Hi,
I just switch my apache to use the worker MM.
I have a filter which uses Cache::SharedMemoryCache to share data
between process (and hopefully threads now).
A simple example is this:
---
use Cache::SharedMemoryCache;
$cache = new Cache::SharedMemoryCache(
{
namespace => 'my namespace',
} );
-----
This will result the error:
[Mon Dec 29 17:48:31 2003] [error] [client xxx.xxx.xxx.xxx] Object #260
should have been retrieved already at ../../lib/Stora
ble.pm (autosplit into ../../lib/auto/Storable/thaw.al) line 358, at
/usr/lib/perl5/site_perl/5.8.0/Cache/CacheUtils.pm line
121
After this I switched back to a apache pre-fork MM and the problem
continued.
As Cache::SharedMemoryCache is process independent, even a small script
generate this error.
Later, I switched one more time to apache MM worker and restarted the
server machine.
Everything worked fine.
Does anyone have a clue why this happened?
Should I drop the Cache module and start to use some IPC module directly
(without Storable)?
Thanks,
Raul Dias
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
Re: [MP2] Storable/Cache trobles with MM worker?
Posted by Stas Bekman <st...@stason.org>.
Raul Dias wrote:
> Hi,
>
> I just switch my apache to use the worker MM.
>
> I have a filter which uses Cache::SharedMemoryCache to share data
> between process (and hopefully threads now).
>
> A simple example is this:
> ---
> use Cache::SharedMemoryCache;
> $cache = new Cache::SharedMemoryCache(
> {
> namespace => 'my namespace',
> } );
> -----
>
> This will result the error:
> [Mon Dec 29 17:48:31 2003] [error] [client xxx.xxx.xxx.xxx] Object #260
> should have been retrieved already at ../../lib/Stora
> ble.pm (autosplit into ../../lib/auto/Storable/thaw.al) line 358, at
> /usr/lib/perl5/site_perl/5.8.0/Cache/CacheUtils.pm line
> 121
>
> After this I switched back to a apache pre-fork MM and the problem
> continued.
>
> As Cache::SharedMemoryCache is process independent, even a small script
> generate this error.
>
> Later, I switched one more time to apache MM worker and restarted the
> server machine.
>
> Everything worked fine.
>
> Does anyone have a clue why this happened?
Is it possible that it's an issue Jan has mentioned yesterday:
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-12/msg00994.html
since it uses PL_modglobal which is not properly CLONEd on perl_clone (used
under threaded mpms). What happens if you patch Storable.xs the way Jan
explained and rebuild/install it?
Perrin Harkins wrote:
> You could also try to just share variables between the threads, which is
> the only way to share without using Storable. The trouble is, objects are
> not easy to share in this way, and any performance you gain may be
> cancelled out by the generally poor performance of Perl threads.
s/generally poor performance of Perl threads/poor performance of starting new
Perl threads/, otherwise the runtime performance is not any different from
normal Perl.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
Re: [MP2] Storable/Cache trobles with MM worker?
Posted by Perrin Harkins <pe...@elem.com>.
Raul Dias said:
> [Mon Dec 29 17:48:31 2003] [error] [client xxx.xxx.xxx.xxx] Object #260
> should have been retrieved already at ../../lib/Stora
> ble.pm (autosplit into ../../lib/auto/Storable/thaw.al) line 358, at
> /usr/lib/perl5/site_perl/5.8.0/Cache/CacheUtils.pm line
> 121
You may need to clean up the shared memory segments. However, I would
recommend that you simply stop using Cache::SharedMemoryCache, since it's
very slow. Take a look at MLDBM::Sync instead, or IPC::MM if you want
real speed. Both of those are many times faster than
Cache::SharedMemoryCache.
You could also try to just share variables between the threads, which is
the only way to share without using Storable. The trouble is, objects are
not easy to share in this way, and any performance you gain may be
cancelled out by the generally poor performance of Perl threads.
- Perrin
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html