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 Förtsch <to...@gmx.net> on 2004/10/29 19:37:33 UTC
$0 ?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
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?
Torsten
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBgn/iwicyCTir8T4RAuNAAJ48CXRTdtlMTQx5V+Yk0KvbtNTGMgCgt7Vm
01eeEfHkoK7EE1ydENCkStE=
=xt8c
-----END PGP SIGNATURE-----
--
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: $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
Re: $0 ?
Posted by Torsten Foertsch <to...@gmx.net>.
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 Pratik <pr...@gmail.com>.
I don't know about mp2. But in mp1, I tried to assign some value to $0
in PerlChildInitHandler, and it gave segmentation fault. I haven't
looked into it in details. I'd like to know if this is a known issue
or not.
-Pratik
On Fri, 29 Oct 2004 16:13:19 -0400, Stas Bekman <st...@stason.org> wrote:
> Torsten Förtsch wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > 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?
> >>
> >>What is it that you are trying to do? Change $0 and affect the way it's
> >>seen from the outside?
> >
> >
> > yes. I have some requests with postprocessing. I want to know, what processes
> > are affected.
> >
> >
> >>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.
>
>
>
>
> --
> __________________________________________________________________
> 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
>
>
--
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: $0 ?
Posted by Stas Bekman <st...@stason.org>.
Torsten Förtsch wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> 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?
>>
>>What is it that you are trying to do? Change $0 and affect the way it's
>>seen from the outside?
>
>
> yes. I have some requests with postprocessing. I want to know, what processes
> are affected.
>
>
>>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.
--
__________________________________________________________________
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: $0 ?
Posted by Torsten Förtsch <to...@gmx.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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?
>
> What is it that you are trying to do? Change $0 and affect the way it's
> seen from the outside?
yes. I have some requests with postprocessing. I want to know, what processes
are affected.
> 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.
Torsten
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBgo61wicyCTir8T4RAqNVAJ9f7rCz1kSAjS4daSrx9Zu9cCK2vQCfe1Sq
8BCBhMs04T0344g1qMjjjSg=
=8Dm9
-----END PGP SIGNATURE-----
--
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: $0 ?
Posted by Stas Bekman <st...@stason.org>.
Torsten Förtsch wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> 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?
What is it that you are trying to do? Change $0 and affect the way it's
seen from the outside?
Take a look at this commit, which might be of some relevance:
http://marc.theaimsgroup.com/?l=apache-modperl-cvs&m=107672268012042&w=2
--
__________________________________________________________________
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: $0 ?
Posted by David Nicol <da...@gmail.com>.
maybe you could call setproctitle(3) directly, somehow?
On Fri, 29 Oct 2004 19:37:33 +0200, Torsten Förtsch
<to...@gmx.net> wrote:
> modify $0.
--
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