@@ -1738,10 +1738,8 @@ static proxy_worker *internal_find_best_byrequests(const proxy_balancer *balance
1738
1738
1739
1739
/* create workers for new nodes */
1740
1740
if (!cache_share_for ) {
1741
- ap_assert (node_storage -> lock_nodes () == APR_SUCCESS );
1742
1741
update_workers_node (conf , r -> pool , r -> server , 1 , node_table );
1743
1742
check_workers (conf , r -> server );
1744
- node_storage -> unlock_nodes ();
1745
1743
}
1746
1744
1747
1745
/* do this once now to avoid repeating find_node_context_host through loop iterations */
@@ -2989,8 +2987,10 @@ static proxy_worker *find_best_worker(const proxy_balancer *balancer, const prox
2989
2987
return NULL ;
2990
2988
}
2991
2989
2990
+ ap_assert (node_storage -> lock_nodes () == APR_SUCCESS );
2992
2991
candidate = internal_find_best_byrequests (balancer , conf , r , domain , failoverdomain , vhost_table , context_table ,
2993
2992
node_table );
2993
+ node_storage -> unlock_nodes ();
2994
2994
2995
2995
if ((rv = PROXY_THREAD_UNLOCK (balancer )) != APR_SUCCESS ) {
2996
2996
ap_log_error (APLOG_MARK , APLOG_ERR , rv , r -> server ,
@@ -3237,7 +3237,6 @@ static int proxy_cluster_pre_request(proxy_worker **worker, proxy_balancer **bal
3237
3237
check_workers (conf , r -> server );
3238
3238
node_storage -> unlock_nodes ();
3239
3239
if (!(* balancer = ap_proxy_get_balancer (r -> pool , conf , * url , 0 ))) {
3240
- /* node_storage->unlock_nodes(); */
3241
3240
ap_log_error (APLOG_MARK , APLOG_ERR , 0 , r -> server , "proxy_cluster_pre_request: CLUSTER no balancer for %s" ,
3242
3241
* url );
3243
3242
return DECLINED ;
@@ -3247,8 +3246,9 @@ static int proxy_cluster_pre_request(proxy_worker **worker, proxy_balancer **bal
3247
3246
}
3248
3247
3249
3248
/* Step 2: find the session route */
3250
-
3249
+ ap_assert ( node_storage -> lock_nodes () == APR_SUCCESS );
3251
3250
runtime = find_session_route (* balancer , r , & route , & sticky , url , & domain , vhost_table , context_table , node_table );
3251
+ node_storage -> unlock_nodes ();
3252
3252
3253
3253
/* Lock the LoadBalancer
3254
3254
* XXX: perhaps we need the process lock here
@@ -3329,9 +3329,6 @@ static int proxy_cluster_pre_request(proxy_worker **worker, proxy_balancer **bal
3329
3329
* worker = runtime ;
3330
3330
}
3331
3331
3332
- (* worker )-> s -> busy ++ ;
3333
- apr_pool_cleanup_register (r -> pool , * worker , decrement_busy_count , apr_pool_cleanup_null );
3334
-
3335
3332
/* Also mark the context here note that find_best_worker set BALANCER_CONTEXT_ID */
3336
3333
context_id = apr_table_get (r -> subprocess_env , "BALANCER_CONTEXT_ID" );
3337
3334
ap_assert (node_storage -> lock_nodes () == APR_SUCCESS );
@@ -3343,7 +3340,9 @@ static int proxy_cluster_pre_request(proxy_worker **worker, proxy_balancer **bal
3343
3340
/* XXX: Do we need the lock here??? */
3344
3341
helper = (proxy_cluster_helper * )(* worker )-> context ;
3345
3342
helper -> count_active ++ ;
3343
+ (* worker )-> s -> busy ++ ;
3346
3344
node_storage -> unlock_nodes ();
3345
+ apr_pool_cleanup_register (r -> pool , * worker , decrement_busy_count , apr_pool_cleanup_null );
3347
3346
3348
3347
/*
3349
3348
* get_route_balancer already fills all of the notes and some subprocess_env
@@ -3466,6 +3465,7 @@ static int proxy_cluster_post_request(proxy_worker *worker, proxy_balancer *bala
3466
3465
worker -> s -> name ,
3467
3466
#endif
3468
3467
val );
3468
+
3469
3469
worker -> s -> status |= PROXY_WORKER_IN_ERROR ;
3470
3470
worker -> s -> error_time = apr_time_now ();
3471
3471
break ;
0 commit comments