You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Gareth Harper <ga...@guardian.co.uk> on 2004/11/10 19:07:29 UTC

[BUG?] Problems with Apache::Status and B::TerseSize

I'm working with Solaris 2.8, mod_perl 1.99_17, Apache 2.0.52

mod_perl installed fine, and runs wonderfully (and up to twice as fast 
as the current compiled c module).  The one problem we're having is with 
slightly high memory usage, which can probably be alleviated if I add in 
a few explicit exports and remove a few perl modules which aren't really 
being used.

I came across the mod_perl 1 doc at 
http://perl.apache.org/docs/1.0/guide/performance.html#Measuring_the_Memory_of_the_Process

I realise this is for mod_perl 1 and not 2 which we're using, but a lot 
of the documentation works on both anyways.

Having configured Apache::Status correctly and getting listings for the 
various modules which are loaded, I came across a slight bug in 
Apache::Status (line 102) where if there isn't a $VERSION in a module 
Apache::Status barfs, I corrected this with a small fix from

    # if !$opt we skip the testing for the option
    return 0 if $opt && !status_config($r, $opt);
    return 0 unless eval { require $file };
    return 0 unless $module->VERSION >= $version;

to

    # if !$opt we skip the testing for the option
    return 0 if $opt && !status_config($r, $opt);
    return 0 unless eval { require $file };
    return 0 unless defined($module->VERSION);
    return 0 unless $module->VERSION >= $version;


Having got this far, I was now able to display the content and which 
vaiables/exports etc our modules were loading.  However, when I tried to 
hook this into B::TerseSize I continually get the following error when 
trying to start apache

bash-2.03$ sudo /apache2/bin/apachectl start
[Wed Nov 10 18:06:22 2004] [error] Can't locate object method "module" 
via package "Apache" (perhaps you forgot to load "Apache"?) at 
/opt/perl/lib/site_perl/5.6.1/sun4-solaris-thread-multi/B/TerseSize.pm 
line 581.\nCompilation failed in require at (eval 3) line 3.\n
[Wed Nov 10 18:06:22 2004] [error] Can't load Perl module B::TerseSize 
for server <servername>, exiting...

I imagine this is because the hooks into Apache::Status in B::TerseSize 
are somewhat out of date with regards to mod_perl 2, has anyone come 
across this problem previously and come up with a solution ?  It is of 
course very prossible (probable?) that I'm missing something very 
obvious, in which case a small hit with a clue bat would be nice too :)

(I figured I would at least ask here before I started digging into 
B::TerseSize and trying to fix it myself).

Thanks in advance
Gareth Harper

-- 

Guardian Unlimited



-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [BUG?] Problems with Apache::Status and B::TerseSize

Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
>>Having configured Apache::Status correctly and getting listings for the
>>various modules which are loaded, I came across a slight bug in
>>Apache::Status (line 102) where if there isn't a $VERSION in a module
>>Apache::Status barfs, I corrected this with a small fix from
>>
>>   # if !$opt we skip the testing for the option
>>   return 0 if $opt && !status_config($r, $opt);
>>   return 0 unless eval { require $file };
>>   return 0 unless $module->VERSION >= $version;
>>
>>to
>>
>>   # if !$opt we skip the testing for the option
>>   return 0 if $opt && !status_config($r, $opt);
>>   return 0 unless eval { require $file };
>>   return 0 unless defined($module->VERSION);
>>   return 0 unless $module->VERSION >= $version;
> 
> 
> from the looks of it, that function is for internal use only - it only
> checks for the modules in $required, all of which should have versions.  but
> stas would know more...

That bug was fixed in 1.99_17

>>I imagine this is because the hooks into Apache::Status in B::TerseSize
>>are somewhat out of date with regards to mod_perl 2, has anyone come
>>across this problem previously and come up with a solution ?
> 
> 
> either use Apache::compat, or change
> 
>   Apache::Status->menu_item(
>       'status_memory_usage' => "Memory Usage",
>       \&status_memory_usage,
>   ) if IS_MODPERL and Apache->module("Apache::Status");
> 
> to (the untested :)
> 
>   Apache::Status->menu_item(
>       'status_memory_usage' => "Memory Usage",
>       \&status_memory_usage,
>   ) if IS_MODPERL and eval { require Apache::Module;
>                              Apache::Module::loaded("Apache::Status");
>                            };
> 
> or somesuch.

And that's fixed in the cvs version.

so get the cvs version and where both problems were already fixed:
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution


-- 
__________________________________________________________________
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

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [BUG?] Problems with Apache::Status and B::TerseSize

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> Having configured Apache::Status correctly and getting listings for the
> various modules which are loaded, I came across a slight bug in
> Apache::Status (line 102) where if there isn't a $VERSION in a module
> Apache::Status barfs, I corrected this with a small fix from
> 
>    # if !$opt we skip the testing for the option
>    return 0 if $opt && !status_config($r, $opt);
>    return 0 unless eval { require $file };
>    return 0 unless $module->VERSION >= $version;
> 
> to
> 
>    # if !$opt we skip the testing for the option
>    return 0 if $opt && !status_config($r, $opt);
>    return 0 unless eval { require $file };
>    return 0 unless defined($module->VERSION);
>    return 0 unless $module->VERSION >= $version;

from the looks of it, that function is for internal use only - it only
checks for the modules in $required, all of which should have versions.  but
stas would know more...

> I imagine this is because the hooks into Apache::Status in B::TerseSize
> are somewhat out of date with regards to mod_perl 2, has anyone come
> across this problem previously and come up with a solution ?

either use Apache::compat, or change

  Apache::Status->menu_item(
      'status_memory_usage' => "Memory Usage",
      \&status_memory_usage,
  ) if IS_MODPERL and Apache->module("Apache::Status");

to (the untested :)

  Apache::Status->menu_item(
      'status_memory_usage' => "Memory Usage",
      \&status_memory_usage,
  ) if IS_MODPERL and eval { require Apache::Module;
                             Apache::Module::loaded("Apache::Status");
                           };

or somesuch.

HTH

--Geoff

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html