2.0.31 on Windows as service

2002-02-05 Thread Dwayne Miller

This morning, for the first time on my system, Apache 2.0.(31) started 
as a service automatically.  I was so thrilled that I restarted the 
computer to see it again.  And it worked.

Then later, I lost my DHCP lease, and had to reboot again.  This time, 
the following text was in my error.log.  I'm guessing it has something 
to do with Win2000 and it's NULL handles for stdout, stdin and stderr... 
but I'm not sure.  Anyway, thought I'd pass it on.  I'm going to look 
into it later this evening.

[Tue Feb 05 10:32:37 2002] [info] Parent: Created child process 632
[Tue Feb 05 10:32:39 2002] [info] Parent: Duplicating socket 208 and 
sending it to child process 632
[Tue Feb 05 10:32:39 2002] [info] Child 632: Child process is running
[Tue Feb 05 10:32:39 2002] [info] Parent: BytesWritten = 372 
WSAProtocolInfo = 2006620
[Tue Feb 05 10:32:39 2002] [crit] (22506)The handle is invalid.  : 
child: Unable to access scoreboard handle from parent
[Tue Feb 05 10:32:39 2002] [info] Parent: Duplicating socket 204 and 
sending it to child process 632
[Tue Feb 05 10:32:39 2002] [emerg] (22506)The handle is invalid.  : 
OpenEvent on  event
[Tue Feb 05 10:32:40 2002] [info] Parent: BytesWritten = 372 
WSAProtocolInfo = 2006620
[Tue Feb 05 10:32:40 2002] [info] Parent: Duplicating socket 200 and 
sending it to child process 632
[Tue Feb 05 10:32:41 2002] [crit] (32522)An invalid argument was 
supplied.  : Parent: WSADuplicateSocket failed for socket 5341448. Check 
the FAQ.
[Tue Feb 05 10:32:41 2002] [crit] (32522)An invalid argument was 
supplied.  : master_main: create child process failed. Exiting.
[Tue Feb 05 10:32:41 2002] [info] Parent: Forcing termination of child 
process 1244900
[Tue Feb 05 10:32:41 2002] [info] removed PID file 
D:/Apache2/logs/httpd.pid (pid=516)





Re: 2.0.31 on Windows as service

2002-02-05 Thread William A. Rowe, Jr.

From: Dwayne Miller [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 12:40 PM


 This morning, for the first time on my system, Apache 2.0.(31) started 
 as a service automatically.  I was so thrilled that I restarted the 
 computer to see it again.  And it worked.

:)

 Then later, I lost my DHCP lease, and had to reboot again.  This time, 
 the following text was in my error.log.  I'm guessing it has something 
 to do with Win2000 and it's NULL handles for stdout, stdin and stderr... 
 but I'm not sure.  Anyway, thought I'd pass it on.  I'm going to look 
 into it later this evening.

Dwayne...

  what CPU is your box on [staring on hunches here] ... speed?

  Was this a soft restart apache -k restart or a hard restart?

  I suspect the apr_file_stdfoo_open stuff could trounce the mpm's own
pipe channel.  I'll research in a bit.

Bill




Re: 2.0.31 on Windows as service

2002-02-05 Thread William A. Rowe, Jr.

From: Dwayne Miller [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 1:09 PM


 Dwayne...
 
   what CPU is your box on [staring on hunches here] ... speed?
 
 It's a laptop with an 850 Mhz Pentium.  Actual id is
 x86 Family 6 Model 8 Stepping 6 GenuineIntel
 
 More info than you need??   :)

No.  I think the failures are related to the performance of the CPU - I think
we've overtaken the Kernel.

   Was this a soft restart apache -k restart or a hard restart?
 
 I just clicked on the restart computer option on the shutdown menu.  I 
 did not gracefully stop the apache service first.

Yup.  If you use Mark's procexp program from sysinterals.com you will see you
have no apPID_shutdown event.  That Event is critical for shutdown, the rest
of the errors you see follow from that missing bit.

   I suspect the apr_file_stdfoo_open stuff could trounce the mpm's own
 pipe channel.  I'll research in a bit.

I'm actually getting this running under some SoftIce to see what falls out.

Bill




Re: 2.0.31 on Windows as service

2002-02-05 Thread Dwayne Miller



William A. Rowe, Jr. wrote:

From: Dwayne Miller [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 1:09 PM


Dwayne...

 what CPU is your box on [staring on hunches here] ... speed?

It's a laptop with an 850 Mhz Pentium.  Actual id is
x86 Family 6 Model 8 Stepping 6 GenuineIntel

More info than you need??   :)


No.  I think the failures are related to the performance of the CPU - I think
we've overtaken the Kernel.

 Was this a soft restart apache -k restart or a hard restart?

I just clicked on the restart computer option on the shutdown menu.  I 
did not gracefully stop the apache service first.


Yup.  If you use Mark's procexp program from sysinterals.com you will see you
have no apPID_shutdown event.  That Event is critical for shutdown, the rest
of the errors you see follow from that missing bit.

The apPID_shutdown event is what comes out of an apache -k restart or 
apache -k shutdown?  What does Windows service manager do to stop a 
service...yank the rug out from under it?

Since my error occurred on startup (I believe),  why does the improper 
shutdown of Apache influence it's startup?


 I suspect the apr_file_stdfoo_open stuff could trounce the mpm's own
pipe channel.  I'll research in a bit.


I'm actually getting this running under some SoftIce to see what falls out.

Bill






Re: 2.0.31 on Windows as service

2002-02-05 Thread William A. Rowe, Jr.

From: Dwayne Miller [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 1:45 PM


 William A. Rowe, Jr. wrote:
 
  Was this a soft restart apache -k restart or a hard restart?
 
 I just clicked on the restart computer option on the shutdown menu.  I 
 did not gracefully stop the apache service first.
 
 
 Yup.  If you use Mark's procexp program from sysinterals.com you will see you
 have no apPID_shutdown event.  That Event is critical for shutdown, the rest
 of the errors you see follow from that missing bit.
 
 The apPID_shutdown event is what comes out of an apache -k restart or 
 apache -k shutdown?  What does Windows service manager do to stop a 
 service...yank the rug out from under it?

SCM - Apache parent SCM monitor thread : SHUTDOWN
monitor thread - send ourself the shutdown_event signal
parent main thread - Ugh, shutdown?  Ok, tell children to die.
  children didn't die?  Kill em.
  stop program.

That's the nutshell at least.

 Since my error occurred on startup (I believe),  why does the improper 
 shutdown of Apache influence it's startup?

It shouldn't, but the CreateEvent stuff seems hosed.  Try setting the service
to 'Log in as a Specific User' (you) and see if that changes anything.






Re: 2.0.31 on Windows as service

2002-02-05 Thread Dwayne Miller

I've been watching the log files and restarting the server for a while 
now.  Looks like the child may be starting before the parent has 
completely opened and written to all of the pipes.

William A. Rowe, Jr. wrote:

From: Dwayne Miller [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 1:45 PM


William A. Rowe, Jr. wrote:

Was this a soft restart apache -k restart or a hard restart?

I just clicked on the restart computer option on the shutdown menu.  I 
did not gracefully stop the apache service first.

Yup.  If you use Mark's procexp program from sysinterals.com you will see you
have no apPID_shutdown event.  That Event is critical for shutdown, the rest
of the errors you see follow from that missing bit.

The apPID_shutdown event is what comes out of an apache -k restart or 
apache -k shutdown?  What does Windows service manager do to stop a 
service...yank the rug out from under it?


SCM - Apache parent SCM monitor thread : SHUTDOWN
monitor thread - send ourself the shutdown_event signal
parent main thread - Ugh, shutdown?  Ok, tell children to die.
  children didn't die?  Kill em.
  stop program.

That's the nutshell at least.

Since my error occurred on startup (I believe),  why does the improper 
shutdown of Apache influence it's startup?


It shouldn't, but the CreateEvent stuff seems hosed.  Try setting the service
to 'Log in as a Specific User' (you) and see if that changes anything.








Re: 2.0.31 on Windows

2002-02-04 Thread Dwayne Miller

I'm not familiar with the -n apache2 option, but I was just trying to 
figure out why I can't get apache to run as a service.  I'm using the -k 
start option, a message that it's starting the service appears, but 
nothing happens.  In the service.c file, I added a line to print the 
'Failed to start the service' message as I was not seeing this message 
in any of my log files.  It in fact fails to start the service.

Bill Stoddard wrote:

Couple of problems noticed in a few minutes of testing

1. apache -k restart -n apache2 is broken. hangs forever and a new child process is 
never
started.

2. If I kill off the child process (by attaching and detaching a debugger for 
instance),
the parent should detect the child process exit and start a new child process. 
Instead,
the parent goes belly up.

Beta killers (for Windows at least).

Bill






Re: 2.0.31 on Windows

2002-02-04 Thread William A. Rowe, Jr.

From: Bill Stoddard [EMAIL PROTECTED]
Sent: Monday, February 04, 2002 10:50 AM


 Couple of problems noticed in a few minutes of testing
 
 1. apache -k restart -n apache2 is broken. hangs forever and a new child process is 
never
 started.
 
 2. If I kill off the child process (by attaching and detaching a debugger for 
instance),
 the parent should detect the child process exit and start a new child process. 
Instead,
 the parent goes belly up.
 
 Beta killers (for Windows at least).

Yup.

Can we have a bit of patience on .32, a day or two, so I can get these fixed?

Bill - which version of Win32?

Bill




Re: 2.0.31 on Windows

2002-02-04 Thread Dwayne Miller



William A. Rowe, Jr. wrote:

From: Dwayne Miller [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 04, 2002 3:57 PM
Subject: Re: 2.0.31 on Windows


I tracked down my problem with not being able to run Apache as a 
service.  The ServerRoot param was not set correctly.  It was /Apache2 
instead of D:/Apache2.  
This configuration file error was never logged anywhere.  Not only that, 
even with this setting, Apache would run fine from the command line.


The 'service' mode has all sorts of peculiar behaviors.  You've identified
exactly what I'm seeing today.

Which Win32 OS are you using, exactly?

I'm on Windows 2000, build 2195, SP2


But trying to start as a server, the ap_walk_config() routine, called in 
server/config.c returned the error  and called exit(1).

Somewhere, this error should be presented to the user.  I'm just not 
sure where, or how to do it.


Definately the biggest 'bug' of the hour is the service logging.  It looks
like some changes a little ways back in main.c borked us.

And the second bug is the lack of -d -f args in the service's Parameters
registry key ... ConfigArgs is coming up empty.

I was looking at mpm_winnt.c, where the apr_filepath_merge() call is 
made.  It looks like it is trying to build the -d argument to use when 
starting the service, but it's obviously not having the desired effect.


The final bug is the simple one.  Why paths can't merge right in the service.
I suspect that's the whole LocalService/non-Network situation going on... 
but it's worthless to debug without resolving the bigger error logging fish :)

The only real answer is moving the service code into apr, pre-main() or in
tandem with apr_initialize() [starting with apr_app_main and getting the
service stuff tied in.]  But I wanted to wait for .33 on those changes.

Bill






Re: 2.0.31 on Windows

2002-02-04 Thread William A. Rowe, Jr.

From: Dwayne Miller [EMAIL PROTECTED]
Sent: Monday, February 04, 2002 5:13 PM


 Which Win32 OS are you using, exactly?
 
 I'm on Windows 2000, build 2195, SP2

Win2000/XP have NULL stdin/stdout/stderr handles...

the create_process() invokes ap_open_stderr_log() which in turn invokes 
apr_file_open_stderr() attempting to open a NULL STDERR handle.

The patch I just committed reinvokes ap_open_stderr_log() after we jump into
the service control manager track with a stderr pipe that we capture to the
application event log.  

The right solution is to finish the move of the service manager code in the
apr_app_initialize code (apr_initialize + apr_app_main) which I hadn't finished
yet, and didn't plan to for a week, maybe two =-/

 I was looking at mpm_winnt.c, where the apr_filepath_merge() call is 
 made.  It looks like it is trying to build the -d argument to use when 
 starting the service, but it's obviously not having the desired effect.

That's where things are still goofy... I'm still debugging.

More updates as they become available.

Bill




Re: 2.0.31 on Windows

2002-02-04 Thread Dwayne Miller

I guess I'm alittle confused... I don't see any errors related to NULL 
file handles.  And the thing about the ServerRoot starting with a /, it 
seems that the process found the config file okay, so wouldn't it also 
know what the ServerRoot should be?

And why doesn't Apache complain about the invalid ServerRoot variable 
when started from the command line?  Even with the -t option, the error 
is unrecognized.

I tried adding the -d option through the Service Manager to use when 
starting the service manually, with no change in behavior.

I'll keep looking...

Tks,
Dwayne

William A. Rowe, Jr. wrote:

From: Dwayne Miller [EMAIL PROTECTED]
Sent: Monday, February 04, 2002 5:13 PM


Which Win32 OS are you using, exactly?

I'm on Windows 2000, build 2195, SP2


Win2000/XP have NULL stdin/stdout/stderr handles...

the create_process() invokes ap_open_stderr_log() which in turn invokes 
apr_file_open_stderr() attempting to open a NULL STDERR handle.

The patch I just committed reinvokes ap_open_stderr_log() after we jump into
the service control manager track with a stderr pipe that we capture to the
application event log.  

The right solution is to finish the move of the service manager code in the
apr_app_initialize code (apr_initialize + apr_app_main) which I hadn't finished
yet, and didn't plan to for a week, maybe two =-/

I was looking at mpm_winnt.c, where the apr_filepath_merge() call is 
made.  It looks like it is trying to build the -d argument to use when 
starting the service, but it's obviously not having the desired effect.


That's where things are still goofy... I'm still debugging.

More updates as they become available.

Bill