|
|
41a6c3 |
diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
|
|
|
41a6c3 |
index 2121892..6f904b2 100644
|
|
|
41a6c3 |
--- a/modules/proxy/proxy_util.c
|
|
|
41a6c3 |
+++ b/modules/proxy/proxy_util.c
|
|
|
41a6c3 |
@@ -2838,33 +2838,48 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
|
|
|
41a6c3 |
|
|
|
41a6c3 |
connected = 1;
|
|
|
41a6c3 |
}
|
|
|
41a6c3 |
- /*
|
|
|
41a6c3 |
- * Put the entire worker to error state if
|
|
|
41a6c3 |
- * the PROXY_WORKER_IGNORE_ERRORS flag is not set.
|
|
|
41a6c3 |
- * Altrough some connections may be alive
|
|
|
41a6c3 |
- * no further connections to the worker could be made
|
|
|
41a6c3 |
- */
|
|
|
41a6c3 |
- if (!connected && PROXY_WORKER_IS_USABLE(worker) &&
|
|
|
41a6c3 |
- !(worker->s->status & PROXY_WORKER_IGNORE_ERRORS)) {
|
|
|
41a6c3 |
- worker->s->error_time = apr_time_now();
|
|
|
41a6c3 |
- worker->s->status |= PROXY_WORKER_IN_ERROR;
|
|
|
41a6c3 |
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00959)
|
|
|
41a6c3 |
- "ap_proxy_connect_backend disabling worker for (%s) for %"
|
|
|
41a6c3 |
- APR_TIME_T_FMT "s",
|
|
|
41a6c3 |
- worker->s->hostname, apr_time_sec(worker->s->retry));
|
|
|
41a6c3 |
+
|
|
|
41a6c3 |
+ if (PROXY_WORKER_IS_USABLE(worker)) {
|
|
|
41a6c3 |
+ /*
|
|
|
41a6c3 |
+ * Put the entire worker to error state if
|
|
|
41a6c3 |
+ * the PROXY_WORKER_IGNORE_ERRORS flag is not set.
|
|
|
41a6c3 |
+ * Although some connections may be alive
|
|
|
41a6c3 |
+ * no further connections to the worker could be made
|
|
|
41a6c3 |
+ */
|
|
|
41a6c3 |
+ if (!connected) {
|
|
|
41a6c3 |
+ if (!(worker->s->status & PROXY_WORKER_IGNORE_ERRORS)) {
|
|
|
41a6c3 |
+ worker->s->error_time = apr_time_now();
|
|
|
41a6c3 |
+ worker->s->status |= PROXY_WORKER_IN_ERROR;
|
|
|
41a6c3 |
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00959)
|
|
|
41a6c3 |
+ "ap_proxy_connect_backend disabling worker for (%s) for %"
|
|
|
41a6c3 |
+ APR_TIME_T_FMT "s",
|
|
|
41a6c3 |
+ worker->s->hostname, apr_time_sec(worker->s->retry));
|
|
|
41a6c3 |
+ }
|
|
|
41a6c3 |
+ }
|
|
|
41a6c3 |
+ else {
|
|
|
41a6c3 |
+ if (worker->s->retries) {
|
|
|
41a6c3 |
+ /*
|
|
|
41a6c3 |
+ * A worker came back. So here is where we need to
|
|
|
41a6c3 |
+ * either reset all params to initial conditions or
|
|
|
41a6c3 |
+ * apply some sort of aging
|
|
|
41a6c3 |
+ */
|
|
|
41a6c3 |
+ }
|
|
|
41a6c3 |
+ worker->s->error_time = 0;
|
|
|
41a6c3 |
+ worker->s->retries = 0;
|
|
|
41a6c3 |
+ }
|
|
|
41a6c3 |
+ return connected ? OK : DECLINED;
|
|
|
41a6c3 |
}
|
|
|
41a6c3 |
else {
|
|
|
41a6c3 |
- if (worker->s->retries) {
|
|
|
41a6c3 |
- /*
|
|
|
41a6c3 |
- * A worker came back. So here is where we need to
|
|
|
41a6c3 |
- * either reset all params to initial conditions or
|
|
|
41a6c3 |
- * apply some sort of aging
|
|
|
41a6c3 |
- */
|
|
|
41a6c3 |
- }
|
|
|
41a6c3 |
- worker->s->error_time = 0;
|
|
|
41a6c3 |
- worker->s->retries = 0;
|
|
|
41a6c3 |
+ /*
|
|
|
41a6c3 |
+ * The worker is in error likely done by a different thread / process
|
|
|
41a6c3 |
+ * e.g. for a timeout or bad status. We should respect this and should
|
|
|
41a6c3 |
+ * not continue with a connection via this worker even if we got one.
|
|
|
41a6c3 |
+ */
|
|
|
41a6c3 |
+ if (connected) {
|
|
|
41a6c3 |
+ socket_cleanup(conn);
|
|
|
41a6c3 |
+ }
|
|
|
41a6c3 |
+ return DECLINED;
|
|
|
41a6c3 |
}
|
|
|
41a6c3 |
- return connected ? OK : DECLINED;
|
|
|
41a6c3 |
}
|
|
|
41a6c3 |
|
|
|
41a6c3 |
PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
|