You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Torsten Foertsch <to...@gmx.net> on 2004/12/30 16:18:09 UTC

Re: $0 ?

On Friday 29 October 2004 22:13, Stas Bekman wrote:
> Torsten Förtsch wrote:
> > On Friday 29 October 2004 20:17, Stas Bekman wrote:
> >>>perl allows to modify $0. Then top, ps & co would display the new
> >>> process title. Can the process title of a mod_perl modified apache be
> >>> set this way?
> >>
...
> >>Take a look at this commit, which might be of some relevance:
> >>http://marc.theaimsgroup.com/?l=apache-modperl-cvs&m=107672268012042&w=2
> >
> > But I see, it is not supported.
>
> Due to internal Apache corruptions, no.

I have just uploaded Sys::Proctitle that modifies the process title at C 
level. It works only on linux. I have tried it with 2.0.52+mp2-RC1.

To the internal Apache corruptions: my first attempt was simply to make a copy 
of __environ via malloc() and strdup(). With pure perl that worked but with 
apache/mod_perl it gave segfaults or double free messages from glibc 
depending on the require'ing or use'ing of the module. Some poking on 
putenv/getenv/setenv source code revealed big magic and led me to the 
following approach of copying the environment:

    clearenv();
    for( i=0; envp[i]; i++ ) {
      char *cp=strchr( envp[i], '=' );
      if( cp ) {
	*cp++='\0';
	setenv( envp[i], cp, 1 );
      }
    }

clearenv() simply sets __environ=NULL. setenv() then builds a new environment.

I don't know anything about how mp2 and apache interact regarding the 
environment. But maybe it helps to let $0 be assigned to in mod_perl.

Again, the module is very linux specific.

As an example of using Sys::Proctitle I have uploaded Apache::ShowStatus. It 
provides a PerlInitHandler that places a Sys::Proctitle object in $r->pnotes 
changing the command line to "httpd: ".$r->the_request. When the request is 
deleted the object is destroyed and the command line is changed back. 
Obviously this makes sense only with prefork mpm.

Torsten

Re: $0 ?

Posted by Stas Bekman <st...@stason.org>.
Torsten Foertsch wrote:
> On Friday 29 October 2004 22:13, Stas Bekman wrote:
> 
>>Torsten Förtsch wrote:
>>
>>>On Friday 29 October 2004 20:17, Stas Bekman wrote:
>>>
>>>>>perl allows to modify $0. Then top, ps & co would display the new
>>>>>process title. Can the process title of a mod_perl modified apache be
>>>>>set this way?
>>>>
> ...
> 
>>>>Take a look at this commit, which might be of some relevance:
>>>>http://marc.theaimsgroup.com/?l=apache-modperl-cvs&m=107672268012042&w=2
>>>
>>>But I see, it is not supported.
>>
>>Due to internal Apache corruptions, no.
> 
> 
> I have just uploaded Sys::Proctitle that modifies the process title at C 
> level. It works only on linux. I have tried it with 2.0.52+mp2-RC1.
> 
> To the internal Apache corruptions: my first attempt was simply to make a copy 
> of __environ via malloc() and strdup(). With pure perl that worked but with 
> apache/mod_perl it gave segfaults or double free messages from glibc 
> depending on the require'ing or use'ing of the module. Some poking on 
> putenv/getenv/setenv source code revealed big magic and led me to the 
> following approach of copying the environment:
> 
>     clearenv();
>     for( i=0; envp[i]; i++ ) {
>       char *cp=strchr( envp[i], '=' );
>       if( cp ) {
> 	*cp++='\0';
> 	setenv( envp[i], cp, 1 );
>       }
>     }

where is the copy? I don't see any data allocated.

> clearenv() simply sets __environ=NULL. setenv() then builds a new environment.
> 
> I don't know anything about how mp2 and apache interact regarding the 
> environment. But maybe it helps to let $0 be assigned to in mod_perl.

You don't want to know :)

As you can see from the email you've quoted the problem is really coming 
from Perl, not Apache.

-- 
__________________________________________________________________
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: Some tests failed: mod_perl-2.0.0-RC2-XMas on FC3

Posted by Stas Bekman <st...@stason.org>.
Patrick LeBoutillier wrote:
> Hi all,
> 
> I get the following test errors on a plain Fedora Core 3 install:
> 
> Failed Test                   Stat Wstat Total Fail  Failed  List of Failed
> -------------------------------------------------------------------------------
> t/api/access2.t                              6    3  50.00%  2 5-6
> t/filter/both_str_req_proxy.t                1    1 100.00%  1
> 5 tests skipped.
> Failed 2/221 test scripts, 99.10% okay. 4/2271 subtests failed, 99.82% okay.
> [warning] server localhost:8529 shutdown
> [  error] error running tests (please examine t/logs/error_log)
> +--------------------------------------------------------+
> | Please file a bug report: http://perl.apache.org/bugs/ |
> +--------------------------------------------------------+
> make: *** [run_tests] Error 1
> 
> I saw someone having similar errors with Apache 2.1.x, but I'm running
> 2.0.52.
> 
> How can I run only those specific tests with more verbose output?

We know, but please read modperl-2.0/README:

-----------------------------------------
Apache:
   Dynamic mod_perl (DSO):    Apache 2.0.47 - 2.0.52.
   Static mod_perl:           Apache 2.0.51 - 2.0.52.

   Newer Apache versions may work with this version of mod_perl.  If
   not, the svn version likely will, which can be obtained from:
 
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
-----------------------------------------

I suppose we should explicitly state that:

   Apache 2.1 is not officially supported at the moment.

The reason: Apache 2.1 API is not finalized, so in the environment of 
scarce resources, it's a waste of time to try and fix things if they may 
change any moment.

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


Some tests failed: mod_perl-2.0.0-RC2-XMas on FC3

Posted by Patrick LeBoutillier <pa...@fusemail.com>.
Hi all,

I get the following test errors on a plain Fedora Core 3 install:

Failed Test                   Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/api/access2.t                              6    3  50.00%  2 5-6
t/filter/both_str_req_proxy.t                1    1 100.00%  1
5 tests skipped.
Failed 2/221 test scripts, 99.10% okay. 4/2271 subtests failed, 99.82% okay.
[warning] server localhost:8529 shutdown
[  error] error running tests (please examine t/logs/error_log)
+--------------------------------------------------------+
| Please file a bug report: http://perl.apache.org/bugs/ |
+--------------------------------------------------------+
make: *** [run_tests] Error 1

I saw someone having similar errors with Apache 2.1.x, but I'm running
2.0.52.

How can I run only those specific tests with more verbose output?

Patrick


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