You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2014/06/28 17:01:12 UTC

svn commit: r1606368 - in /httpd/httpd/trunk: docs/log-message-tags/next-number server/mpm/winnt/child.c

Author: trawick
Date: Sat Jun 28 15:01:11 2014
New Revision: 1606368

URL: http://svn.apache.org/r1606368
Log:
Follow up to r1527220/r1588852:

Implement better error checking/reporting around notification of abrupt parent
process termination.

It is likely that something bad is happening here based on these
user reports:

https://www.apachelounge.com/viewtopic.php?p=27848
http://mail-archives.apache.org/mod_mbox/httpd-users/201406.mbox/%3CCAC%2BRZnuwLD%2BJnoy2TYO8oeAWt6bFLMa%3DEhfDf9hS3cuuGUHXAw%40mail.gmail.com%3E


Modified:
    httpd/httpd/trunk/docs/log-message-tags/next-number
    httpd/httpd/trunk/server/mpm/winnt/child.c

Modified: httpd/httpd/trunk/docs/log-message-tags/next-number
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/log-message-tags/next-number?rev=1606368&r1=1606367&r2=1606368&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/log-message-tags/next-number (original)
+++ httpd/httpd/trunk/docs/log-message-tags/next-number Sat Jun 28 15:01:11 2014
@@ -1 +1 @@
-2643
+2645

Modified: httpd/httpd/trunk/server/mpm/winnt/child.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/winnt/child.c?rev=1606368&r1=1606367&r2=1606368&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/child.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/child.c Sat Jun 28 15:01:11 2014
@@ -986,7 +986,15 @@ void child_main(apr_pool_t *pconf, DWORD
 
     if (parent_pid != my_pid) {
         child_events[2] = OpenProcess(SYNCHRONIZE, FALSE, parent_pid);
-        num_events = 3;
+        if (child_events[2] == NULL) {
+            num_events = 2;
+            ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), ap_server_conf, APLOGNO(02643)
+                         "Child: Failed to open handle to parent process %ld; "
+                         "will not react to abrupt parent termination", parent_pid);
+        }
+        else {
+            num_events = 3;
+        }
     }
     else {
         /* presumably -DONE_PROCESS */
@@ -1097,7 +1105,7 @@ void child_main(apr_pool_t *pconf, DWORD
         apr_sleep(apr_time_from_sec(1));
     }
 
-    /* Wait for one of three events:
+    /* Wait for one of these events:
      * exit_event:
      *    The exit_event is signaled by the parent process to notify
      *    the child that it is time to exit.
@@ -1106,6 +1114,8 @@ void child_main(apr_pool_t *pconf, DWORD
      *    This event is signaled by the worker threads to indicate that
      *    the process has handled MaxConnectionsPerChild connections.
      *
+     * parent process exiting
+     *
      * TIMEOUT:
      *    To do periodic maintenance on the server (check for thread exits,
      *    number of completion contexts, etc.)
@@ -1126,6 +1136,7 @@ void child_main(apr_pool_t *pconf, DWORD
         rv = WaitForMultipleObjects(num_events, (HANDLE *)child_events, FALSE, INFINITE);
         cld = rv - WAIT_OBJECT_0;
 #else
+        /* THIS IS THE EXPECTED BUILD VARIATION */
         rv = WaitForMultipleObjects(num_events, (HANDLE *)child_events, FALSE, 1000);
         cld = rv - WAIT_OBJECT_0;
         if (rv == WAIT_TIMEOUT) {
@@ -1138,6 +1149,17 @@ void child_main(apr_pool_t *pconf, DWORD
             ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(),
                          ap_server_conf, APLOGNO(00356)
                          "Child: WAIT_FAILED -- shutting down server");
+            /* check handle validity to identify a possible culprit */
+            for (i = 0; i < num_events; i++) {
+                DWORD out_flags;
+
+                if (0 == GetHandleInformation(child_events[i], &out_flags)) {
+                    ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(),
+                                 ap_server_conf, APLOGNO(02644)
+                                 "Child: Event handle #%d (%ld) is invalid",
+                                 i, child_events[i]);
+                }
+            }
             break;
         }
         else if (cld == 0) {



Re: svn commit: r1606368 - in /httpd/httpd/trunk: docs/log-message-tags/next-number server/mpm/winnt/child.c

Posted by Eric Covener <co...@gmail.com>.
On Tue, Jul 8, 2014 at 10:27 AM, Jeff Trawick <tr...@gmail.com> wrote:
> Does r1608785 help???

yep, thanks

-- 
Eric Covener
covener@gmail.com

Re: svn commit: r1606368 - in /httpd/httpd/trunk: docs/log-message-tags/next-number server/mpm/winnt/child.c

Posted by Jeff Trawick <tr...@gmail.com>.
On Tue, Jul 8, 2014 at 9:46 AM, Eric Covener <co...@gmail.com> wrote:

> On Sat, Jun 28, 2014 at 11:01 AM,  <tr...@apache.org> wrote:
> > @@ -1126,6 +1136,7 @@ void child_main(apr_pool_t *pconf, DWORD
> >          rv = WaitForMultipleObjects(num_events, (HANDLE *)child_events,
> FALSE, INFINITE);
> >          cld = rv - WAIT_OBJECT_0;
> >  #else
> > +        /* THIS IS THE EXPECTED BUILD VARIATION */
> >          rv = WaitForMultipleObjects(num_events, (HANDLE *)child_events,
> FALSE, 1000);
> >          cld = rv - WAIT_OBJECT_0;
> >          if (rv == WAIT_TIMEOUT) {
>
> Was reviewing for 2.4, what does the comment mean?
>
> --
> Eric Covener
> covener@gmail.com
>


Sorry :)

That #else right before it is part of

#if !APR_HAS_OTHER_CHILD
...
#else
    /* THIS IS THE EXPECTED BUILD VARIATION */
...
#endif

and I always forget which is the normal path on Windows.

Does r1608785 help???

(Wow, researching why my first two attempts to reply here failed really
pisses me off.  A domain listed in my sig is listed in the Spamhaus
database, and it appears that I have to change my mail configuration for
that domain just to be able to submit a request to remove it :( )

Re: svn commit: r1606368 - in /httpd/httpd/trunk: docs/log-message-tags/next-number server/mpm/winnt/child.c

Posted by Eric Covener <co...@gmail.com>.
On Sat, Jun 28, 2014 at 11:01 AM,  <tr...@apache.org> wrote:
> @@ -1126,6 +1136,7 @@ void child_main(apr_pool_t *pconf, DWORD
>          rv = WaitForMultipleObjects(num_events, (HANDLE *)child_events, FALSE, INFINITE);
>          cld = rv - WAIT_OBJECT_0;
>  #else
> +        /* THIS IS THE EXPECTED BUILD VARIATION */
>          rv = WaitForMultipleObjects(num_events, (HANDLE *)child_events, FALSE, 1000);
>          cld = rv - WAIT_OBJECT_0;
>          if (rv == WAIT_TIMEOUT) {

Was reviewing for 2.4, what does the comment mean?

-- 
Eric Covener
covener@gmail.com