You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2017/03/07 19:10:19 UTC

svn commit: r1785871 - in /httpd/httpd/trunk: docs/log-message-tags/next-number modules/proxy/mod_proxy_hcheck.c

Author: jim
Date: Tue Mar  7 19:10:19 2017
New Revision: 1785871

URL: http://svn.apache.org/viewvc?rev=1785871&view=rev
Log:
Defensive

Modified:
    httpd/httpd/trunk/docs/log-message-tags/next-number
    httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.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=1785871&r1=1785870&r2=1785871&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/log-message-tags/next-number (original)
+++ httpd/httpd/trunk/docs/log-message-tags/next-number Tue Mar  7 19:10:19 2017
@@ -1 +1 @@
-10019
+10020

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c?rev=1785871&r1=1785870&r2=1785871&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c Tue Mar  7 19:10:19 2017
@@ -981,11 +981,13 @@ static int hc_post_config(apr_pool_t *p,
                        apr_pool_t *ptemp, server_rec *s)
 {
     apr_status_t rv;
-    sctx_t *ctx;
 
     APR_OPTIONAL_FN_TYPE(ap_watchdog_get_instance) *hc_watchdog_get_instance;
     APR_OPTIONAL_FN_TYPE(ap_watchdog_register_callback) *hc_watchdog_register_callback;
 
+    if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) {
+        return OK;
+    }
     hc_watchdog_get_instance = APR_RETRIEVE_OPTIONAL_FN(ap_watchdog_get_instance);
     hc_watchdog_register_callback = APR_RETRIEVE_OPTIONAL_FN(ap_watchdog_register_callback);
     if (!hc_watchdog_get_instance || !hc_watchdog_register_callback) {
@@ -1003,9 +1005,16 @@ static int hc_post_config(apr_pool_t *p,
         return !OK;
     }
     while (s) {
-        ctx = (sctx_t *) ap_get_module_config(s->module_config,
-                                              &proxy_hcheck_module);
+        sctx_t *ctx = ap_get_module_config(s->module_config,
+                                           &proxy_hcheck_module);
 
+        if (s != ctx->s) {
+            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(10019)
+                         "We somehow have a context/server mismatch (%pp:%pp)",
+                         s, ctx->s);
+            s = s->next;
+            continue;
+        }
         rv = hc_watchdog_register_callback(watchdog,
                 apr_time_from_sec(HCHECK_WATHCHDOG_INTERVAL),
                 ctx,