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