restart_count() on Win32

2006-01-17 Thread Foo Ji-Haw



Hello all,
 
I am trying my luck again on this issue, which I 
never quite understood/ resolved.
 
Whenever Apache starts/ restarts, it actually does 
this twice (the second time to see if it can restart properly). 
 
In my httpd.conf:
PerlModule startup
 
in startup.pm:
package startup;
use strict;
use warnings;
 
BEGIN
{
open OUTFILE,'>debug.log';
print OUTFILE 
Apache2::ServerUtil::restart_count()."\n";
close OUTFILE;
}
 
1;
 
The log file shows this when Apache 
starts:
1
2
1
2
 
And the log file shows this when Apache 
restarts:
3
1
2
 
I don't understand why I get 2 '1's and 2 '2's when 
Apache starts. According to the documentation, I should expect only 1 '1' and 1 
'2'. Similarly for restarts, the order looks wrong (the doc says to expect '1' 
'3' instead of '3' '1' and no '2').
 
Hope someone can enlighten me on this subject. 
Thanks.


Re: File handle in mod_perl

2006-01-17 Thread Tom Schindl
Hi,

It seems that you are not modifying the files so no lock is needed. If
to clients are accessing your webserver at the very same moment there
are 2 Apache-Processes working so there is not interference between them.

One more sidenote you can read files as a whole using:
--8<--
{
   local $/ = undef;
   my var1='';
   open( H, "/usr/local/my_setup" );
  my $var1 = ;
   close( H );
}
--8<--

Still you should only read the whole content of a file into memory if
you really needed to because perl is designed in a way that it will not
release the memory any more (this is only relevant for very big files).

Tom

LUKE wrote:
> I have some problem about file handle in mod_perlV2.02 + apache v2.055.
> I got some strange result today.And i check the program find
> that i forgot to close(filehande).
> But this case  to bring about some guestion! Will the code influence
> each other? When
> muti-user visit the same recourse at the same time?
>  
> One clint at A and another in B.
>  
> Q1.How to avoid this situation??
> Need i lock file when i reading file??
>  
> Q2.what is difference between FLOCK_SH and FLOCK_EX ?
>  
> #!/usr/bin/perl
> sub main{
> 
> print Header();  #print http header
> 
> my var1='';
> open(H,"/usr/local/my_setup");
> while (){
> $ var1.=$_;#<===A
> }
> close(H);
>  
> my $var2;
> open(H,"/usr/local/my_page");
> while (){
> $ var2.=$_;#<===B
> }
> close(H);
>  
> $var2=~s/SomeText/$var1/igs;
>  
> print $var2;
>  
> return;
> }
>  
> main();
> 1;



signature.asc
Description: OpenPGP digital signature


Re: restart_count() on Win32

2006-01-17 Thread Tom Schindl
Hi,

i'd say that the thing you are seening is that 3rd restart is the one
where the actually running apache is checking that a restart is possible
and else refusing to stop?

Try logging the PID's of the process trying to restart?

Tom

Foo Ji-Haw wrote:
> Hello all,
>  
> I am trying my luck again on this issue, which I never quite understood/
> resolved.
>  
> Whenever Apache starts/ restarts, it actually does this twice (the
> second time to see if it can restart properly).
>  
> In my httpd.conf:
> PerlModule startup
>  
> in startup.pm:
> package startup;
> use strict;
> use warnings;
>  
> BEGIN
> {
> open OUTFILE,'>debug.log';
> print OUTFILE Apache2::ServerUtil::restart_count()."\n";
> close OUTFILE;
> }
>  
> 1;
>  
> The log file shows this when Apache starts:
> 1
> 2
> 1
> 2
>  
> And the log file shows this when Apache restarts:
> 3
> 1
> 2
>  
> I don't understand why I get 2 '1's and 2 '2's when Apache starts.
> According to the documentation, I should expect only 1 '1' and 1 '2'.
> Similarly for restarts, the order looks wrong (the doc says to expect
> '1' '3' instead of '3' '1' and no '2').
>  
> Hope someone can enlighten me on this subject. Thanks.



signature.asc
Description: OpenPGP digital signature


Re: restart_count() on Win32

2006-01-17 Thread Foo Ji-Haw
Hello Tom,

Thanks for your reply. Perhaps you can help explain why I am receiving 2
'1's and 2 '2's upon Apache start (not restart). I can code to only load
stuff on restart_count() == 2, but this works only for restarts, since
starts give me 2 '2's on restart_count(). If I can figure out how to do
initialise once, I can even try to spawn threads properly.

Can anyone confirm if this is a Windows Thing, or it happens to FreeBSD/
Linux installations as well?

- Original Message - 
From: "Tom Schindl" <[EMAIL PROTECTED]>
To: "Foo Ji-Haw" <[EMAIL PROTECTED]>
Cc: 
Sent: Tuesday, January 17, 2006 5:12 PM
Subject: Re: restart_count() on Win32

Hi,

i'd say that the thing you are seening is that 3rd restart is the one
where the actually running apache is checking that a restart is possible
and else refusing to stop?

Try logging the PID's of the process trying to restart?



Re: restart_count() on Win32

2006-01-17 Thread Tom Schindl
Hi,

I gave it a try on linux:

- for start you get:
1
2

- for restart 1 you get:
3
- for restart 2 you get:
4
- for restart 3 you get:
5
- for restart 4 you get:
6

There's no difference between prefork and worker-mpm. I'm not a win32
guy so I cann't help you here.

Tom

Foo Ji-Haw wrote:
> Hello Tom,
> 
> Thanks for your reply. Perhaps you can help explain why I am receiving 2
> '1's and 2 '2's upon Apache start (not restart). I can code to only load
> stuff on restart_count() == 2, but this works only for restarts, since
> starts give me 2 '2's on restart_count(). If I can figure out how to do
> initialise once, I can even try to spawn threads properly.
> 
> Can anyone confirm if this is a Windows Thing, or it happens to FreeBSD/
> Linux installations as well?
> 
> - Original Message - 
> From: "Tom Schindl" <[EMAIL PROTECTED]>
> To: "Foo Ji-Haw" <[EMAIL PROTECTED]>
> Cc: 
> Sent: Tuesday, January 17, 2006 5:12 PM
> Subject: Re: restart_count() on Win32
> 
> Hi,
> 
> i'd say that the thing you are seening is that 3rd restart is the one
> where the actually running apache is checking that a restart is possible
> and else refusing to stop?
> 
> Try logging the PID's of the process trying to restart?
> 
> 



signature.asc
Description: OpenPGP digital signature


Re: Apache::DBI and DBD::Pg

2006-01-17 Thread Tim Bunce
On Mon, Jan 16, 2006 at 12:42:10PM -0800, Tyler MacDonald wrote:
> Jeremy Nixon <[EMAIL PROTECTED]> wrote:
> > It looks like it would work perfectly with connect_cached, which I hadn't
> > known about, but now that I do, I'm all excited to change my code to use
> > it instead of Apache::DBI.
> 
>   *instead*, eh... I'm using it as well... Could this be part of the
> problem? Does Apache::DBI interfere with DBI->connect_cached or vice-versa?

DBI->connect_cached will automatically call Apache::DBI->connect
if Apache::DBI was loaded before DBI, or if you do

$DBI::connect_via = "Apache::DBI::connect";

Tim.


Re: File handle in mod_perl

2006-01-17 Thread Perrin Harkins
On Tue, 2006-01-17 at 15:00 +0800, LUKE wrote:
> But this case  to bring about some guestion! Will the code influence
> each other? When 
> muti-user visit the same recourse at the same time?

This code only seems to be reading from files, not writing to them, so
there will be no interaction between processes.

> Q1.How to avoid this situation??
> Need i lock file when i reading file??

You only need to use locking if you are writing to the file from one or
more processes.
 
> Q2.what is difference between FLOCK_SH and FLOCK_EX ?

SH is shared and EX is exclusive.  See the Perl documentation for
examples of how to use flock.

- Perrin



Re: Apache::DBI and DBD::Pg

2006-01-17 Thread Perrin Harkins
On Mon, 2006-01-16 at 23:15 +, Jeremy Nixon wrote:
> That code has to work identically in or out of mod_perl, so it can't
> have any mod_perl-specific stuff inside it.

I usually handle that by checking $ENV{MOD_PERL}:

our %CACHE;
sub set_value {
my ($key, $value) = @_;
if ($ENV{MOD_PERL}) {
Apache->request->pnotes($key, $value);
} else {
$CACHE{$key} = $value;
}
}

> Read committed is no problem, since it's the default

Unfortunately, InnoDB defaults to "repeatable read", so I always have to
change it.

> DBI won't let you do the latter at all, it just tells you to use DBI
> methods for transactions, and there is no DBI method for that.

Maybe you should ask on the dbi-users list to see what other people do.
There must be others who have dealt with this.

>   You can't
> do the first option when AutoCommit is off, because you can't do "begin",
> but if you do the "set transaction" it tells you there is no transaction
> open.

InnoDB always has a transaction open, even in AutoCommit.  Very
different behavior.

>   So I have to turn AutoCommit on, open a transaction, then send
> the "set transaction" query.  Then I have to remember, for that particular
> database handle, to put AutoCommit back where it was before after a
> commit or rollback -- which means I have to keep state on each handle I
> have open.

You can sometimes use local() to good effect:

{
local $dbh->{AutoCommit} = 1;
... do some stuff ...
}

At the end of the block, it goes back to whatever state it was in
before.

> My bet, though, is that I messed up somewhere in the logic
> that caches my instances, trying to be a little too clever.

That would explain the behavior you described.

> Anyway, I now have all this code that doesn't use prepared statements
> at all, so I'm not in a good position to quickly try it

There are definite speed benefits to using prepare_cached, especially
with a database like Pg that has server-side prepared statements.  You
may want to experiment with it again in the future.

- Perrin



Re: Apache::DBI and DBD::Pg

2006-01-17 Thread Peter Haworth
On Mon, 16 Jan 2006 23:15:59 + (UTC), Jeremy Nixon wrote:
> There are two
> ways to put a transaction into that mode: you can open a transaction and
> then "set transaction isolation level serializable", or you can open the
> transaction by doing "begin transaction isolation level serializable".
> 
> DBI won't let you do the latter at all, it just tells you to use DBI
> methods for transactions, and there is no DBI method for that.  You can't
> do the first option when AutoCommit is off, because you can't do "begin",
> but if you do the "set transaction" it tells you there is no transaction
> open.  So I have to turn AutoCommit on, open a transaction, then send
> the "set transaction" query.  Then I have to remember, for that particular
> database handle, to put AutoCommit back where it was before after a
> commit or rollback -- which means I have to keep state on each handle I
> have open.
> 
> I do so wish for an AutoCommit mode that tells DBI, "just let me handle
> it, ok thanks".  Pass-through mode.  Get-the-heck-out-of-my-way mode.
> I've honestly considered dropping DBI completely and just using the
> direct C library interface.

If you have AutoCommit on, there *is* a DBI method to explicitly start a
transaction, and you'll go back to normal at the next commit()/rollback():

  $dbh->begin_work;
  $dbh->do('set transaction isolation level serializable');

Or, if AutoCommit is off, you could force a transaction to start, then set
the isolation level:

  $dbh->do('select 1'); # Or an update which doesn't match anything
  $dbh->do('set transaction isolation level serializable');

Or, if you want this isolation level to apply to everything, say so when
you connect:

  $dbh->do("set default_transaction_isolation to 'serializable'");


I haven't tested any of these, since I haven't needed to change the isolation
level since the bad old days of Illustra, when "read uncommitted" was
necessary to even approach reasonable performance on our horrible system.

-- 
Peter Haworth   [EMAIL PROTECTED]
"I am the Supreme Being, you know. I'm not entirely dim."
-- God (in Time Bandits)


Re: Apache::DBI and DBD::Pg

2006-01-17 Thread Perrin Harkins
On Tue, 2006-01-17 at 16:06 +, Peter Haworth wrote:
> I haven't tested any of these, since I haven't needed to change the isolation
> level since the bad old days of Illustra, when "read uncommitted" was
> necessary to even approach reasonable performance on our horrible system.

Wow, I thought I was the only one who ever had to use Illustra.

For InnoDB users, I definitely recommend switching from "repeatable
read" to "read committed", since it behaves the way most people would
expect (i.e. you can see other people's committed data without having to
issue a commit yourself).

- Perrin



Using MP2 and CPAN modules

2006-01-17 Thread Dan Axtell
Hi,

my server is running Apache 2.0.54 and MP 2.0.2.  I'm trying to become 
familiar with the environment, but I get the impression most CPAN modules 
really want to run under Apache 1.X.

In particular, I installed Apache::SessionManager, but can't get Apache to 
restart when I add the config lines

PerlModule Apache::SessionManager
PerlTransHandler Apache::SessionManager

I get the error "Can't locate Apache/Const.pm " when Apache tries to load 
SessionManager.

I know that the SessionManager module is requiring modules like Apache::Const, 
Apache::RequestRec, Apache::SubRequest, etc. which all exist on my system as 
Apache2::*.   I've tried using those but I get another set of errors.  I'm 
not confident of my ability to rewrite this module to get it working.

So I'm wondering in general, should I downgrade to Apache/mod_perl version 1 
if I want to use CPAN modules?  Or is MP2 really becoming the preferred 
environment?

Thanks,
Dan


Re: Using MP2 and CPAN modules

2006-01-17 Thread Tom Schindl
Hi,

no I wouldn't downgrade to mp1 because Apache2.x is the future and
someday Apache1.x will not be maintained any more. I'd try to contact
the maintainer of Apache::SessionManager which is as it looks not
prepared to work with mp2. You can also hack it yourself using the guide
provided at http://perl.apache.org/docs/2.0/rename.html

One more note please start a new thread when posting to a new topic.

Tom

Dan Axtell wrote:
> Hi,
> 
> my server is running Apache 2.0.54 and MP 2.0.2.  I'm trying to become 
> familiar with the environment, but I get the impression most CPAN modules 
> really want to run under Apache 1.X.
> 
> In particular, I installed Apache::SessionManager, but can't get Apache to 
> restart when I add the config lines
> 
> PerlModule Apache::SessionManager
> PerlTransHandler Apache::SessionManager
> 
> I get the error "Can't locate Apache/Const.pm " when Apache tries to load 
> SessionManager.
> 
> I know that the SessionManager module is requiring modules like 
> Apache::Const, 
> Apache::RequestRec, Apache::SubRequest, etc. which all exist on my system as 
> Apache2::*.   I've tried using those but I get another set of errors.  I'm 
> not confident of my ability to rewrite this module to get it working.
> 
> So I'm wondering in general, should I downgrade to Apache/mod_perl version 1 
> if I want to use CPAN modules?  Or is MP2 really becoming the preferred 
> environment?
> 
> Thanks,
> Dan
> 
> 



signature.asc
Description: OpenPGP digital signature


Re: Using MP2 and CPAN modules

2006-01-17 Thread Frank Wiles
On Tue, 17 Jan 2006 14:07:56 -0500
Dan Axtell <[EMAIL PROTECTED]> wrote:

> my server is running Apache 2.0.54 and MP 2.0.2.  I'm trying to
> become familiar with the environment, but I get the impression most
> CPAN modules really want to run under Apache 1.X.
> 
> In particular, I installed Apache::SessionManager, but can't get
> Apache to restart when I add the config lines
> 
> PerlModule Apache::SessionManager
> PerlTransHandler Apache::SessionManager
> 
> I get the error "Can't locate Apache/Const.pm " when Apache tries to
> load SessionManager.
> 
> I know that the SessionManager module is requiring modules like
> Apache::Const, Apache::RequestRec, Apache::SubRequest, etc. which all
> exist on my system as Apache2::*.   I've tried using those but I get
> another set of errors.  I'm not confident of my ability to rewrite
> this module to get it working.
> 
> So I'm wondering in general, should I downgrade to Apache/mod_perl
> version 1 if I want to use CPAN modules?  Or is MP2 really becoming
> the preferred environment?

  Hi Dan, 

  You'll find that many CPAN modules have been ported to work with
  2.x, but some still haven't.  Typically the code change is very
  easy, I would bet it you contact the author of the module they
  can get it upgraded quickly. 

  If you've having trouble with a particular module, let me know and
  I'll take a look at it and get it ported.  Can't guarantee how
  fast I can get it done, but I'll do my best. 

 -
   Frank Wiles <[EMAIL PROTECTED]>
   http://www.wiles.org
 -



Re: Using MP2 and CPAN modules

2006-01-17 Thread Geoffrey Young


Tom Schindl wrote:
> Hi,
> 
> no I wouldn't downgrade to mp1 because Apache2.x is the future and
> someday Apache1.x will not be maintained any more.

wow, really?

:)

> I'd try to contact
> the maintainer of Apache::SessionManager which is as it looks not
> prepared to work with mp2. You can also hack it yourself using the guide
> provided at http://perl.apache.org/docs/2.0/rename.html

just to be clear to the original poster, given this original error:

>>I get the error "Can't locate Apache/Const.pm " when Apache tries to load 
>>SessionManager.

it looks like Apache::SessionManager is stuck on a pre-official-2.0 mp2
release.  using apache 1.3/mp1 will "solve" your problem as far as this
particular module goes, but it's necessarily the easiest path to follow.

as tom suggested, to use this module you'll need to use the rename link
above as a guide to a full port.  for the most part, the change looks to be
pretty simple - look for "MP2" in the code and change Apache:: to Apache2::
following the rename.html guidelines.  Apache::REDIRECT and Apache::DECLINED
will become Apache2::Const::REDIRECT and Apache2::Const::DECLINED.  and
don't change Apache::Cookie ;)

anyway, that should help get you on the proper path.

HTH

--Geoff


Re: Using MP2 and CPAN modules

2006-01-17 Thread Tom Schindl
Geoffrey Young wrote:
> 
> Tom Schindl wrote:
> 
>>Hi,
>>
>>no I wouldn't downgrade to mp1 because Apache2.x is the future and
>>someday Apache1.x will not be maintained any more.
> 
> 
> wow, really?
> 
> :)

Just for curiosity how long do you think Geoff Apache1.x will be
maintained is there any official statement from Apache.org?

Tom


signature.asc
Description: OpenPGP digital signature


More on Apache::SessionManager/MP2

2006-01-17 Thread Dan Axtell
OK, so I followed the guidelines and changed mod_perl, Apache2::*, constants, 
etc.   I had to uncomment a reference to Apache2::Connection so references to 
$r->connection->remote_ip() would work.

At that point, I can restart the server and load SessionManager, but the 
minute I try to connect to localhost, I get a 404 error and the logs show 
only "File does not exist: (null)".  This is merely from loading the module, 
not actually using it for anything.   

So at this point it seems like the module is really unusable, at least for 
mere mortals like myself.



Re: Using MP2 and CPAN modules

2006-01-17 Thread Geoffrey Young

>>>no I wouldn't downgrade to mp1 because Apache2.x is the future and
>>>someday Apache1.x will not be maintained any more.
>>
>>
>>wow, really?
>>
>>:)
> 
> 
> Just for curiosity how long do you think Geoff Apache1.x will be
> maintained

for a very, very long time.

the largest apache-based shops still run 1.3, and many show no desire to
change from what is, for them, a versitile and super stable platform.  see,
for example, michael radwin's thoughts on apache he gave just last month at
apachecon

   http://public.yahoo.com/~radwin/talks/yapache-apachecon2005.htm

specifically slides 13-16.  if yahoo, with all it's traffic is ok with 1.3
and without thread support that's probably a clue as to how good 1.3 really
is.  and as long as there are people out there using it (especially shops
with as many resources as yahoo) I suspect there will be people out there
still hacking away at 1.3.

mind you, with both apache 1.3 and mp1 it may seem like the project is a
little stagnant, but I don't think that's the case at all - when you reach
this level of stability you don't necessarily go mucking around with it,
taking changes lightly.  but I think if there was a real bug discovered
you'd see a truckload of people jumping on it.  and in that sense, I don't
think 1.3 is going away any time soon.

> is there any official statement from Apache.org?

no, this is just my feeling as an educated observer, not a voice in any sort
of official capacity.  but I don't think an official statement of the kind
you're thinking about would ever come out of the ASF anyway.

--Geoff


Re: restart_count() on Win32

2006-01-17 Thread William A. Rowe, Jr.

Foo Ji-Haw wrote:
 
I am trying my luck again on this issue, which I never quite understood/ 
resolved.
 
The log file shows this when Apache starts:

1  (parent/healthcheck process)
2  (parent/healthcheck process)
1  (child/real server process)
2  (child/real server process)


In 1.3, the child 'owned' the logs and overwrote everthing.  2.0 uses locking
to allow the parent's log entries to be preserved.

The win32 'parent' never serves a request.  It's resources are also not really
inherited by the child, so each child must 'do it's own thing' with respect to
fully initializing the server.


And the log file shows this when Apache restarts:
3 (parent/healthcheck process)
1 (child/real server process)
2 (child/real server process)


The parent signals the 'old child' to begin to shut down (and quit listening
for new connections) while it spawns up a new full blown child process, with
the same child behavior as you noted on first-start.


Apache::Filter after mod_jk?

2006-01-17 Thread Peter Swan

Hi,

I wonder if it is possible to filter the output coming from my Tomcat 
talking via mod_jk to my apache 1.3 with mod_perl 1.29!?


I tried something like

PerlModule Apache::Filter

  SetHandler perl-script
  PerlSetVar Filter On
  PerlHandler myFilter


but 'myFilter' only gets the raw JSP file BEFORE Tomcat had it's fun 
with it...


Maybe I misunderstood the 'Apache::Filter' and it is only possible to 
filter/chain perl-handlers and not real apache handlers...


Is there any trick to solve this problem in Apache 1.3? (Apache 2 has a 
'real' output filter which should do the trick, but unfortunately we 
can't switch.)


Thanks a lot for ANY hints!
   Peter


Re: restart_count() on Win32

2006-01-17 Thread Foo Ji-Haw
Hello Tom,

Thanks for confirming for me it is a Windows Thing.

- Original Message - 
From: "Tom Schindl" <[EMAIL PROTECTED]>
To: "Foo Ji-Haw" <[EMAIL PROTECTED]>
Cc: 
Sent: Tuesday, January 17, 2006 5:43 PM
Subject: Re: restart_count() on Win32

Hi,

I gave it a try on linux:

- for start you get:
1
2

- for restart 1 you get:
3
- for restart 2 you get:
4
- for restart 3 you get:
5
- for restart 4 you get:
6

There's no difference between prefork and worker-mpm. I'm not a win32
guy so I cann't help you here.

Tom


Re: Using MP2 and CPAN modules

2006-01-17 Thread Foo Ji-Haw
> > Just for curiosity how long do you think Geoff Apache1.x will be
> > maintained
>
> for a very, very long time.
According to the Yahoo! slides you gave, they are planning a shift to
Apache2.2 this year...they are side-stepping Apache2?!?

> mind you, with both apache 1.3 and mp1 it may seem like the project is a
> little stagnant, but I don't think that's the case at all - when you reach
> this level of stability you don't necessarily go mucking around with it,
> taking changes lightly.  but I think if there was a real bug discovered
> you'd see a truckload of people jumping on it.  and in that sense, I don't
> think 1.3 is going away any time soon.
I have not had much history with mp1, but from what I read, very few people
ever found the impetus to jump onto mp2. I guess the only guys who do so
are:
1. People who started learning modperl after mp2 is out
2. People who run modperl on Windows as an alternative to PerlEx.





Re: restart_count() on Win32

2006-01-17 Thread Foo Ji-Haw
Hello William,

Thanks for the insight into the inner workings of mp2 on Win32. I'd like to
read up more on the parent-child setup, and digging through perl.apache.org
(mostly in http://perl.apache.org/docs/2.0/) I don't seem to be able to get
any information on mp2 on Win32.

Can you share your source of information on this issue? Thanks.

- Original Message - 
From: "William A. Rowe, Jr." <[EMAIL PROTECTED]>
To: "Foo Ji-Haw" <[EMAIL PROTECTED]>
Cc: 
Sent: Wednesday, January 18, 2006 5:01 AM
Subject: Re: restart_count() on Win32


> Foo Ji-Haw wrote:
> >
> > I am trying my luck again on this issue, which I never quite understood/
> > resolved.
> >
> > The log file shows this when Apache starts:
> > 1  (parent/healthcheck process)
> > 2  (parent/healthcheck process)
> > 1  (child/real server process)
> > 2  (child/real server process)
>
> In 1.3, the child 'owned' the logs and overwrote everthing.  2.0 uses
locking
> to allow the parent's log entries to be preserved.
>
> The win32 'parent' never serves a request.  It's resources are also not
really
> inherited by the child, so each child must 'do it's own thing' with
respect to
> fully initializing the server.
>
> > And the log file shows this when Apache restarts:
> > 3 (parent/healthcheck process)
> > 1 (child/real server process)
> > 2 (child/real server process)
>
> The parent signals the 'old child' to begin to shut down (and quit
listening
> for new connections) while it spawns up a new full blown child process,
with
> the same child behavior as you noted on first-start.



Re: restart_count() on Win32

2006-01-17 Thread Randy Kobes

On Wed, 18 Jan 2006, Foo Ji-Haw wrote:


Hello William,

Thanks for the insight into the inner workings of mp2 on Win32. I'd like to
read up more on the parent-child setup, and digging through perl.apache.org
(mostly in http://perl.apache.org/docs/2.0/) I don't seem to be able to get
any information on mp2 on Win32.

Can you share your source of information on this issue? Thanks.


You may want to check out
 http://f-m-c.org/projects/apache/html/4_3Multitasking_server.html
for a basic discussion.

--
best regards,
randy kobes


Re: restart_count() on Win32

2006-01-17 Thread Foo Ji-Haw
Thanks Randy, for the pointer. Will give it a good read.

- Original Message - 
From: "Randy Kobes" <[EMAIL PROTECTED]>
To: "Foo Ji-Haw" <[EMAIL PROTECTED]>
Cc: "William A. Rowe, Jr." <[EMAIL PROTECTED]>; 
Sent: Wednesday, January 18, 2006 11:56 AM
Subject: Re: restart_count() on Win32


> On Wed, 18 Jan 2006, Foo Ji-Haw wrote:
>
> > Hello William,
> >
> > Thanks for the insight into the inner workings of mp2 on Win32. I'd like
to
> > read up more on the parent-child setup, and digging through
perl.apache.org
> > (mostly in http://perl.apache.org/docs/2.0/) I don't seem to be able to
get
> > any information on mp2 on Win32.
> >
> > Can you share your source of information on this issue? Thanks.
>
> You may want to check out
>   http://f-m-c.org/projects/apache/html/4_3Multitasking_server.html
> for a basic discussion.
>
> -- 
> best regards,
> randy kobes



Re: restart_count() on Win32

2006-01-17 Thread Foo Ji-Haw
Hello Randy,

Do let me know if I am on the right track.

The Windows implementation of Apache2 uses a 2 processes. The worker process
creates the threads upon start/restart. This differs from Unix
implementations where it forks process instead of threads.

In Unix, the main process running modperl loads up the Perl modules, then
forks. In Windows, the worker process (not the supervisor process) loads up
modperl, then creates the threads.

If I am right so far, I still don't understand William's explanation of the
parent process and child process loading up the Perl modules. Does the
supervisor process need to load up modperl as well, thereby giving the
1,2,1,2 result (for restart_count() ) in my test?

Also, how does it generate the 3,1,2 in my server restart test (I have
quoted the codes below)? Does this mean that in a restart, the supervisor
process reloads modperl, then creates the worker process, which loads up and
restarts once?

Let me know if I don't make any sense...thanks.

- Original Message - 
From: "Randy Kobes" <[EMAIL PROTECTED]>
To: "Foo Ji-Haw" <[EMAIL PROTECTED]>
Cc: "William A. Rowe, Jr." <[EMAIL PROTECTED]>; 
Sent: Wednesday, January 18, 2006 11:56 AM
Subject: Re: restart_count() on Win32


> On Wed, 18 Jan 2006, Foo Ji-Haw wrote:
>
> > Hello William,
> >
> > Thanks for the insight into the inner workings of mp2 on Win32. I'd like
to
> > read up more on the parent-child setup, and digging through
perl.apache.org
> > (mostly in http://perl.apache.org/docs/2.0/) I don't seem to be able to
get
> > any information on mp2 on Win32.
> >
> > Can you share your source of information on this issue? Thanks.
>
> You may want to check out
>   http://f-m-c.org/projects/apache/html/4_3Multitasking_server.html
> for a basic discussion.
>
> -- 
> best regards,
> randy kobes
>

Quote from my ealier mail:
In my httpd.conf:
PerlModule startup

in startup.pm:
package startup;
use strict;
use warnings;

BEGIN
{
open OUTFILE,'>debug.log';
print OUTFILE Apache2::ServerUtil::restart_count()."\n";
close OUTFILE;
}

1;

The log file shows this when Apache starts:
1
2
1
2

And the log file shows this when Apache restarts:
3
1
2



libapreq2-2.06-dev apreq_xs_postperl.h

2006-01-17 Thread Ken Perl
 perl Makefile.PL --with-apache2-apxs=/usr/local/apache2/bin/apxs is succes.
but make failed,
cc -c  -I/root/.cpan/build/libapreq2-2.06-dev/glue/perl/xs
-I/root/.cpan/build/libapreq2-2.06-dev/include
-I/root/.cpan/build/libapreq2-2.06-dev/glue/perl/xsbuilder
-I/usr/include/apache2  -I/usr/include/apache2  -D_REENTRANT
-D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing
-I/usr/lib/perl5/5.8.3/i586-linux-thread-multi/CORE -DMOD_PERL
-DMP_COMPAT_1X -DLINUX=2 -D_XOPEN_SOURCE=500 -D_BSD_SOURCE
-D_SVID_SOURCE -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall
-Wall -pipe   -DVERSION=\"2.06-dev\" -DXS_VERSION=\"2.06-dev\" -fPIC
"-I/usr/lib/perl5/5.8.3/i586-linux-thread-multi/CORE"   Apache2.c
In file included from Apache2.xs:39:
/root/.cpan/build/libapreq2-2.06-dev/glue/perl/xsbuilder/apreq_xs_postperl.h:21:34:
modperl_perl_unembed.h: No such file or directory
/root/.cpan/build/libapreq2-2.06-dev/glue/perl/xsbuilder/apreq_xs_postperl.h:24:33:
modperl_common_util.h: No such file or directory
In file included from Apache2.xs:45:
/root/.cpan/build/libapreq2-2.06-dev/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h:1:22:
mod_perl.h: No such file or directory
Apache2.c: In function `XS_APR__Request__Apache2_handle':
Apache2.c:65: warning: implicit declaration of function
`modperl_xs_sv2request_rec'
Apache2.c:65: warning: initialization makes pointer from integer without a cast
make[6]: *** [Apache2.o] Error 1

where these .h could be found?

--
perl -e 'print unpack(u,"62V5N\"FME;G\!E