@@ -201,6 +201,11 @@ static void add_hcheck(server_rec *s, const proxy_server_conf *conf, proxy_worke
201201
202202static int (* ap_proxy_retry_worker_fn )(const char * proxy_function , proxy_worker * worker , server_rec * s ) = NULL ;
203203
204+ static int is_worker_empty (proxy_worker * worker )
205+ {
206+ return worker && (worker -> s -> port == 0 || worker -> s -> scheme [0 ] == '\0' || worker -> s -> hostname [0 ] == '\0' );
207+ }
208+
204209static void check_workers (const proxy_server_conf * conf , const server_rec * s )
205210{
206211 int i ;
@@ -211,13 +216,12 @@ static void check_workers(const proxy_server_conf *conf, const server_rec *s)
211216 proxy_worker * * workers ;
212217 workers = (proxy_worker * * )balancer -> workers -> elts ;
213218 for (j = 0 ; j < balancer -> workers -> nelts ; j ++ , workers ++ ) {
214- volatile proxy_worker * worker = * workers ;
219+ proxy_worker * worker = * workers ;
215220 proxy_cluster_helper * helper ;
216221 int stop_worker = 0 ;
217222 helper = (proxy_cluster_helper * )worker -> context ;
218223 ap_assert (helper ); /* we are in trouble ... */
219- if (worker -> s -> port == 0 && worker -> s -> scheme [0 ] == '\0' && worker -> s -> hostname [0 ] == '\0' &&
220- worker -> s -> route [0 ] == '\0' ) {
224+ if (is_worker_empty (worker )) {
221225 /* this happens when a new child process is created and it "cleaned" some old slotmem */
222226 /* it is like the remove_workers_node we try to restore the non shared memory allocated in
223227 * create_worker() */
@@ -796,7 +800,11 @@ static proxy_worker *get_worker_from_id_stat(const proxy_server_conf *conf, int
796800 proxy_worker * * worker = (proxy_worker * * )ptrw ;
797801 proxy_cluster_helper * helper = (proxy_cluster_helper * )(* worker )-> context ;
798802 if ((* worker )-> s == stat && helper -> index == id ) {
799- return * worker ;
803+ if (is_worker_empty (* worker )) {
804+ return NULL ;
805+ } else {
806+ return * worker ;
807+ }
800808 }
801809 if (helper -> index == id ) {
802810 unpair_worker_node ((* worker )-> s , node );
@@ -2048,7 +2056,7 @@ static int proxy_node_get_free_id(request_rec *r, int node_table_size)
20482056 proxy_worker * * workers ;
20492057 workers = (proxy_worker * * )balancer -> workers -> elts ;
20502058 for (j = 0 ; j < balancer -> workers -> nelts ; j ++ , workers ++ ) {
2051- volatile proxy_worker * worker = * workers ;
2059+ proxy_worker * worker = * workers ;
20522060 proxy_cluster_helper * helper ;
20532061 if (worker -> s -> index >= node_table_size ) {
20542062 ap_log_error (APLOG_MARK , APLOG_WARNING , 0 , r -> server ,
0 commit comments