]> granicus.if.org Git - apache/commitdiff
Seems Terminal Server flavors were failing global_mutex_init, but it was
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 20 Feb 2002 17:18:05 +0000 (17:18 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 20 Feb 2002 17:18:05 +0000 (17:18 +0000)
  somewhat hard to tell, seeing as we never log any status until we can't
  obtain the mutex.  Lots more rv checking is required in here, would
  appreciate if new/touched code grew the appropriate tests.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93515 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/mpm_winnt.c

index 0c8448e3dffec1c904989c9468d1c2f1c1362b1c..5523ff188a1777ab65b988c4086d36c891c22c1d 100644 (file)
@@ -1265,9 +1265,15 @@ static void child_main()
     /* Release the start_mutex to let the new process (in the restart
      * scenario) a chance to begin accepting and servicing requests 
      */
-    ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, ap_server_conf, 
-                 "Child %d: Releasing the start mutex", my_pid);
-    apr_proc_mutex_unlock(start_mutex);
+    rv = apr_proc_mutex_unlock(start_mutex);
+    if (rv == APR_SUCCESS) {
+        ap_log_error(APLOG_MARK,APLOG_INFO | APLOG_NOERRNO, rv, ap_server_conf, 
+                     "Child %d: Released the start mutex", my_pid);
+    }
+    else {
+        ap_log_error(APLOG_MARK,APLOG_ERR, rv, ap_server_conf, 
+                     "Child %d: Failure releasing the start mutex", my_pid);
+    }
 
     /* Tell the worker threads they may exit when done handling
      * a connection.
@@ -2274,10 +2280,16 @@ static int winnt_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pt
              * Ths start mutex is used during a restart to prevent more than one 
              * child process from entering the accept loop at once.
              */
-            apr_proc_mutex_create(&start_mutex, 
-                                  signal_name_prefix,
-                                  APR_LOCK_DEFAULT,
-                                  ap_server_conf->process->pool);
+            rv =  apr_proc_mutex_create(&start_mutex, 
+                                        signal_name_prefix,
+                                        APR_LOCK_DEFAULT,
+                                        ap_server_conf->process->pool);
+            if (rv != APR_SUCCESS) {
+                ap_log_error(APLOG_MARK,APLOG_ERR, rv, ap_server_conf,
+                             "%s: Unable to create the start_mutex.",
+                             service_name);
+                return HTTP_INTERNAL_SERVER_ERROR;
+            }            
         }
     }
     else /* parent_pid != my_pid */
@@ -2311,6 +2323,8 @@ static int winnt_open_logs(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, s
 
 static void winnt_child_init(apr_pool_t *pchild, struct server_rec *ap_server_conf)
 {
+    apr_status_t rv;
+
     setup_signal_names(apr_psprintf(pchild,"ap%d", parent_pid));
 
     /* This is a child process, not in single process mode */
@@ -2323,16 +2337,22 @@ static void winnt_child_init(apr_pool_t *pchild, struct server_rec *ap_server_co
 
         ap_my_generation = atoi(getenv("AP_MY_GENERATION"));
 
-        apr_proc_mutex_child_init(&start_mutex, signal_name_prefix, pconf);
+        rv = apr_proc_mutex_child_init(&start_mutex, signal_name_prefix, pconf);
     }
     else {
         /* Single process mode - this lock doesn't even need to exist */
-        apr_proc_mutex_create(&start_mutex, signal_name_prefix, 
-                             APR_LOCK_DEFAULT, pconf);
+        rv = apr_proc_mutex_create(&start_mutex, signal_name_prefix, 
+                                   APR_LOCK_DEFAULT, pconf);
         
         /* Borrow the shutdown_even as our _child_ loop exit event */
         exit_event = shutdown_event;
     }
+    if (rv != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK,APLOG_ERR, rv, ap_server_conf,
+                     "%s child %d: Unable to init the start_mutex.",
+                     service_name, my_pid);
+        exit(APEXIT_CHILDINIT);
+    }
 }