Re: [PATCH] apr_proc_wait

2001-10-24 Thread Greg Ames

"William A. Rowe, Jr." wrote:
> 
> From: "Greg Ames" <[EMAIL PROTECTED]>
> Sent: Tuesday, October 23, 2001 1:18 PM
> 
> > Looks good here too.  We detect fatal child exits properly, and we get
> > seg fault log messages.  Log replay still runs cleanly on my ThinkPad.
> >
> > Why don't we re-tag after you commit?
> 
> Were you able to get a traceback of any faults in core.c or request.c?

I was intentionally generating seg faults to make sure we could
recover.  We do recover in prefork.  The threaded MPMs and/or my Linux
box seem to have issues.  Don't worry about core.c or request.c

Greg



Re: [PATCH] apr_proc_wait

2001-10-24 Thread William A. Rowe, Jr.

From: "Greg Ames" <[EMAIL PROTECTED]>
Sent: Tuesday, October 23, 2001 1:18 PM


> Looks good here too.  We detect fatal child exits properly, and we get
> seg fault log messages.  Log replay still runs cleanly on my ThinkPad.
> 
> Why don't we re-tag after you commit?  

Were you able to get a traceback of any faults in core.c or request.c?

I'd really like a chance to shoot them down.  Depending on the list lag
tonight, please try dropping a note of any that you generate to the list
and myself?  I'll try to patch-n-go tonight so we can actually get a few
cycles.

If you've got the time tonight, that is :)

Bill




Re: [PATCH] apr_proc_wait

2001-10-23 Thread Jeff Trawick

Branko Čibej <[EMAIL PROTECTED]> writes:

> Jeff Trawick wrote:
> 
> >Ryan Bloom <[EMAIL PROTECTED]> writes:
> >
> >> This patch implements my idea for a new API to apr_proc_wait and
> >> apr_proc_all_wait.
> >>
> >
> >
> >I'm a wee bit nervous that we use an enumerated type for a bitmask.
> >Using an enumeration for the values of the bits seems fine but maybe
> >using some unsigned int value is best?  We'd expect an enumerated type
> >to hold only the values in the enumeration, not some OR of some of
> >them.
> >
> >
> 
> Not so. ISO C explicitly allows this use of enums (and so does ISO C++)..

"We" refers to people, not standards documents or compilers :)

Like I said, it is a nitpick and not something I intend to lose any
sleep over.

-- 
Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
   http://www.geocities.com/SiliconValley/Park/9289/
 Born in Roswell... married an alien...



Re: [PATCH] apr_proc_wait

2001-10-23 Thread Greg Ames

Ryan Bloom wrote:

> > > This patch implements my idea for a new API to apr_proc_wait and
> > > apr_proc_all_wait.

> Committing within an hour.  

Looks good here too.  We detect fatal child exits properly, and we get
seg fault log messages.  Log replay still runs cleanly on my ThinkPad.

Why don't we re-tag after you commit?  

Greg



Re: [PATCH] apr_proc_wait

2001-10-23 Thread Branko Čibej

Jeff Trawick wrote:

>Ryan Bloom <[EMAIL PROTECTED]> writes:
>
>>This patch implements my idea for a new API to apr_proc_wait and 
>>apr_proc_all_wait.
>>
>
>
>I'm a wee bit nervous that we use an enumerated type for a bitmask.
>Using an enumeration for the values of the bits seems fine but maybe
>using some unsigned int value is best?  We'd expect an enumerated type
>to hold only the values in the enumeration, not some OR of some of
>them.
>
>

Not so. ISO C explicitly allows this use of enums (and so does ISO C++)..

-- 
Brane Čibej   <[EMAIL PROTECTED]>   http://www.xbc.nu/brane/






Re: [PATCH] apr_proc_wait

2001-10-23 Thread Ryan Bloom

On Tuesday 23 October 2001 09:50 am, Jeff Trawick wrote:
> Ryan Bloom <[EMAIL PROTECTED]> writes:
> > This patch implements my idea for a new API to apr_proc_wait and
> > apr_proc_all_wait.
>
> 
> I'm a wee bit nervous that we use an enumerated type for a bitmask.
> Using an enumeration for the values of the bits seems fine but maybe
> using some unsigned int value is best?  We'd expect an enumerated type
> to hold only the values in the enumeration, not some OR of some of
> them.
> 
>
> 
> but overall this is an important improvement so +1 for committing it,
> and if by some chance something breaks or a tweak is needed later we
> can easily handle it.
> 

Committing within an hour.  I went back and forth about the enum, and decided
to just use it for now.

Ryan
__
Ryan Bloom  [EMAIL PROTECTED]
Covalent Technologies   [EMAIL PROTECTED]
--



Re: [PATCH] apr_proc_wait

2001-10-23 Thread Jeff Trawick

Ryan Bloom <[EMAIL PROTECTED]> writes:

> This patch implements my idea for a new API to apr_proc_wait and 
> apr_proc_all_wait.


I'm a wee bit nervous that we use an enumerated type for a bitmask.
Using an enumeration for the values of the bits seems fine but maybe
using some unsigned int value is best?  We'd expect an enumerated type
to hold only the values in the enumeration, not some OR of some of
them.



but overall this is an important improvement so +1 for committing it,
and if by some chance something breaks or a tweak is needed later we
can easily handle it.


-- 
Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
   http://www.geocities.com/SiliconValley/Park/9289/
 Born in Roswell... married an alien...



[PATCH] apr_proc_wait

2001-10-22 Thread Ryan Bloom


This patch implements my idea for a new API to apr_proc_wait and 
apr_proc_all_wait.  This includes the changes to Apache as well as the changes
to APR.  The basic concept is that we return the reason for exiting and the
exit code.  If the child was sent a signal and died because of that, the exit
code is the signal that the process received.  The other part of this, is that APR
now has macros that determine if the process has generated a core dump.  If
we want to add more macros to this, we can easily extend it.  This patch
also removes all instances of the W* macros from Apache.

I took the basic idea from Jeff Trawick's patches.

Ryan

Index: include/mpm_common.h
===
RCS file: /home/cvs/httpd-2.0/include/mpm_common.h,v
retrieving revision 1.28
diff -u -d -b -w -u -r1.28 mpm_common.h
--- include/mpm_common.h2001/08/14 12:30:49 1.28
+++ include/mpm_common.h2001/10/22 17:56:16
@@ -125,7 +125,8 @@
  * @param p The pool to allocate out of
  */
 #ifdef AP_MPM_WANT_WAIT_OR_TIMEOUT
-void ap_wait_or_timeout(apr_wait_t *status, apr_proc_t *ret, apr_pool_t *p);
+void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret, 
+apr_pool_t *p);
 #endif
 
 /**
@@ -135,7 +136,7 @@
  * @param status The status returned from ap_wait_or_timeout
  */
 #ifdef AP_MPM_WANT_PROCESS_CHILD_STATUS
-void ap_process_child_status(apr_proc_t *pid, apr_wait_t status);
+void ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status);
 #endif
 
 #if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF)
Index: server/mpm_common.c
===
RCS file: /home/cvs/httpd-2.0/server/mpm_common.c,v
retrieving revision 1.69
diff -u -d -b -w -u -r1.69 mpm_common.c
--- server/mpm_common.c 2001/09/21 14:29:33 1.69
+++ server/mpm_common.c 2001/10/22 17:56:16
@@ -124,7 +124,7 @@
 continue;
 
 proc.pid = pid;
-waitret = apr_proc_wait(&proc, NULL, APR_NOWAIT);
+waitret = apr_proc_wait(&proc, NULL, NULL, APR_NOWAIT);
 if (waitret != APR_CHILD_NOTDONE) {
 MPM_NOTE_CHILD_KILLED(i);
 continue;
@@ -196,7 +196,8 @@
 #endif
 static int wait_or_timeout_counter;
 
-void ap_wait_or_timeout(apr_wait_t *status, apr_proc_t *ret, apr_pool_t *p)
+void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret,
+apr_pool_t *p)
 {
 apr_status_t rv;
 
@@ -204,7 +205,7 @@
 if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
 wait_or_timeout_counter = 0;
 }
-rv = apr_proc_wait_all_procs(ret, status, APR_NOWAIT, p);
+rv = apr_proc_wait_all_procs(ret, exitcode, status, APR_NOWAIT, p);
 if (APR_STATUS_IS_EINTR(rv)) {
 ret->pid = -1;
 return;
@@ -213,7 +214,7 @@
 return;
 }
 #ifdef NEED_WAITPID
-if ((ret = reap_children(status)) > 0) {
+if ((ret = reap_children(exitcode, status)) > 0) {
 return;
 }
 #endif
@@ -224,16 +225,16 @@
 #endif /* AP_MPM_WANT_WAIT_OR_TIMEOUT */
 
 #ifdef AP_MPM_WANT_PROCESS_CHILD_STATUS
-void ap_process_child_status(apr_proc_t *pid, apr_wait_t status)
+void ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status)
 {
-int signum = WTERMSIG(status);
+int signum = status;
 const char *sigdesc = apr_signal_get_description(signum);
 
 /* Child died... if it died due to a fatal error,
 * we should simply bail out.
 */
-if ((WIFEXITED(status)) &&
-WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
+if ((APR_PROC_CHECK_EXIT(why)) &&
+(status == APEXIT_CHILDFATAL)) {
 ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, ap_server_conf,
 "Child %ld returned a Fatal error..." APR_EOL_STR
 "Apache is exiting!",
@@ -241,7 +242,7 @@
 exit(APEXIT_CHILDFATAL);
 }
 
-if (WIFSIGNALED(status)) {
+if (APR_PROC_CHECK_SIGNALED(why)) {
 switch (signum) {
 case SIGTERM:
 case SIGHUP:
@@ -249,8 +250,7 @@
 case SIGKILL:
 break;
 default:
-#ifdef WCOREDUMP
-if (WCOREDUMP(status)) {
+if (APR_PROC_CHECK_CORE_DUMP(why)) {
 ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  0, ap_server_conf,
  "child pid %ld exit signal %s (%d), "
@@ -258,9 +258,7 @@
  (long)pid->pid, sigdesc, signum,
  ap_coredump_dir);
 }
-else
-#endif
-{
+else {
 ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  0, ap_server_conf,
  "child pid %ld exit signal %s (%d)",
Index: server/mpm/beos/beos.c
==