You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by pradeep kumar <pr...@gmail.com> on 2006/01/20 14:52:14 UTC

[mp2] Script replaces the process name with its own name

Hi,

When I run a script say yyy.pl using ab then one of the child process name
is changed to that of the script.

#cat yyyp.pl
#!/opt/perl/bin/perl
  sleep 20;
  print "test\n";

This is just after the script is started.
# ps -ef | grep www
      www  4028  4026  0 17:17:45 ?         0:00 /opt/hpws/apache/bin/httpd
-k start
 kumar  4333  4033  1 17:43:25 pts/1     0:00 grep www
      www  4027  4026  0 17:17:45 ?         0:00
/opt/hpws/apache/cgi-bin/yyy.pl

 And this is the way it looks later(after the script ends):
 # ps -ef | grep www
 kumar  4366  4033  1 17:47:50 pts/1     0:00 grep www
      www  4028  4026  0 17:17:45 ?         0:00 /opt/hpws/apache/bin/httpd
-k start
      www  4027  4026  0 17:17:45 ?         0:00 /opt/hpws/apache/bin/httpd
-k start

Is this behaviour normal and expected or is this a bug?

Regards,
Pradeep

Re: [mp2] Script replaces the process name with its own name

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
pradeep kumar wrote:
> Hi,
> 
> When I run a script say yyy.pl using ab then one of the child process
> name is changed to that of the script.
> 
> #cat yyyp.pl
> #!/opt/perl/bin/perl
>   sleep 20;
>   print "test\n";
> 
> This is just after the script is started.
> # ps -ef | grep www
>       www  4028  4026  0 17:17:45 ?         0:00
> /opt/hpws/apache/bin/httpd -k start
>  kumar  4333  4033  1 17:43:25 pts/1     0:00 grep www
>       www  4027  4026  0 17:17:45 ?         0:00
> /opt/hpws/apache/cgi-bin/yyy.pl
> 
>  And this is the way it looks later(after the script ends):
>  # ps -ef | grep www
>  kumar  4366  4033  1 17:47:50 pts/1     0:00 grep www
>       www  4028  4026  0 17:17:45 ?         0:00
> /opt/hpws/apache/bin/httpd -k start
>       www  4027  4026  0 17:17:45 ?         0:00
> /opt/hpws/apache/bin/httpd -k start
> 
> Is this behaviour normal and expected or is this a bug?

This is basically a feature. For compatibility with plain CGIs, ModPerl::Registry
sets $0 to the script name. And whenever Perl can do it, changing $0 also changes
the process name.

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Re: [mp2] Script replaces the process name with its own name

Posted by Tom Schindl <to...@gmx.at>.
Hi,

a bit more information would help:
- what version of mp are you using
- how does you config look like
- how do you invoke ab?

Tom

pradeep kumar wrote:
> Hi,
> 
> When I run a script say yyy.pl using ab then one of the child process
> name is changed to that of the script.
> 
> #cat yyyp.pl
> #!/opt/perl/bin/perl
>   sleep 20;
>   print "test\n";
> 
> This is just after the script is started.
> # ps -ef | grep www
>       www  4028  4026  0 17:17:45 ?         0:00
> /opt/hpws/apache/bin/httpd -k start
>  kumar  4333  4033  1 17:43:25 pts/1     0:00 grep www
>       www  4027  4026  0 17:17:45 ?         0:00
> /opt/hpws/apache/cgi-bin/yyy.pl
> 
>  And this is the way it looks later(after the script ends):
>  # ps -ef | grep www
>  kumar  4366  4033  1 17:47:50 pts/1     0:00 grep www
>       www  4028  4026  0 17:17:45 ?         0:00
> /opt/hpws/apache/bin/httpd -k start
>       www  4027  4026  0 17:17:45 ?         0:00
> /opt/hpws/apache/bin/httpd -k start
> 
> Is this behaviour normal and expected or is this a bug?
> 
> Regards,
> Pradeep
> 
>