PerlRequire executed 4 times on apache startup

2007-08-28 Thread Tobias Zeising
Hi all,

I have a weird problem: on startup apache executes 4 times a Perl Script
I included via

 PerlPostConfigRequire startup.pl

in the httpd.conf. The startup script contains following code:

 #!/usr/bin/perl

 my $file = 'c:\tmp\test.txt';
 open(INFO ,">>$file") || die "Error $!";
 print INFO "test\n";
 close INFO;
 print STDERR "test...\n";
 1;

After starting the apache server (with an empty test.txt) the error.log
contains as expectet one time "test..." and the test.txt contains
curiously four times "test". That means apache has executed the
startup.pl four times.

I have found http://modperlbook.org/html/ch04_07.html but that "apache
config test" would only explain the execution of two times.

Actually the startup.pl contains some code for preloading a huge amount
of modules, so this needs about 10 seconds instead of 2 or 3.

Hope anybody knows or can explain this behaviour.

Thanks and best regards
 Tobi


Re: PerlRequire executed 4 times on apache startup

2007-08-28 Thread William A. Rowe, Jr.
Tobias Zeising wrote:
> Hi all,
> 
> I have a weird problem: on startup apache executes 4 times a Perl Script
> I included via
> 
>  PerlPostConfigRequire startup.pl

Yes, as Foo observed, this will happen 2x on Unix, 4x on Windows due to the MPM.

Notice that 1x and 2x (and 5x and 8x and 11x upon restarts) are all occurring
in the parent.  They aren't in the worker process at all, they were only pre-
tested to ensure your script compiles and runs.

The 3x and 4x times are in the child process that serves your request.  First
to pretest the config (yes, again!) and then the copy that will persist until
the worker process terminates.

Upon a graceful restart, that copy dies, the config is reprocessed in the parent
1x only again, and then 2x in the child.

We could (obviously) dump the extra success-test in the child.  But doing so
would break a huge assumption by coders like yourselves that rely on the pre
test followed by the actual run.

On Unix, you will see it run 1x for config test, followed by the 2x for the
worker children.  On a graceful restart, you'll see it happen a 3x time, etc.

Bill


Re: PerlRequire executed 4 times on apache startup

2007-08-28 Thread Foo JH
I've had this same experience on Win32 Apache 2 as well. It could be 
related to the MPM model that the Win32 implementation employs.


Tobias Zeising wrote:

Hi all,

I have a weird problem: on startup apache executes 4 times a Perl Script
I included via

 PerlPostConfigRequire startup.pl

in the httpd.conf. The startup script contains following code:

 #!/usr/bin/perl

 my $file = 'c:\tmp\test.txt';
 open(INFO ,">>$file") || die "Error $!";
 print INFO "test\n";
 close INFO;
 print STDERR "test...\n";
 1;

After starting the apache server (with an empty test.txt) the error.log
contains as expectet one time "test..." and the test.txt contains
curiously four times "test". That means apache has executed the
startup.pl four times.

I have found http://modperlbook.org/html/ch04_07.html but that "apache
config test" would only explain the execution of two times.

Actually the startup.pl contains some code for preloading a huge amount
of modules, so this needs about 10 seconds instead of 2 or 3.

Hope anybody knows or can explain this behaviour.

Thanks and best regards
 Tobi
  




building modperl in cygwin

2007-08-28 Thread bhaskar
hi all
  
when i am executed command make for building  mod_perl in 
cygwin, i got the following errors
   
  make[1]: *** [mod_perl.lo] Error 1
make[1]: Leaving directory `/cygdrive/e/mod_perl-2.0-current/mod_perl-2.0.3/src/
modules/perl'
make: *** [modperl_lib] Error 2
   
can ayone help me on this so that i can go forward.
   
  thaking you,
  bhaskar

   
-
Got a little couch potato? 
Check out fun summer activities for kids.

Re: Migrate LWP::UserAgent + HTTP::Request to mod_perl2

2007-08-28 Thread Perrin Harkins
On 8/27/07, Nguyen Vu Hung <[EMAIL PROTECTED]> wrote:
> The following code run without problems under Apache 1.3.29, Perl 5.6.1,
> mod_perl 1.29.
>
> Under the new environment which is Apache 2.0.52, Perl 5.8.8, mod_perl
> 2.0.3 ( Cent OS 4.5 ), it won't run.

There is no mod_perl-related code in what you're showing, so it
doesn't seem like a mod_perl problem.  The problem may be related to
the version of Perl you have or the version of LWP.  Try upgrading
your modules.

- Perrin