Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions native/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,8 @@ node_context *find_node_context_host(request_rec *r, const proxy_balancer *balan
continue;
}
context = &context_table->context_info[j];
ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, r->server,
"find_node_context_host: %s node: %d vhost: %d context: %s", uri, context->node, context->vhost,
context->context);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "find_node_context_host: %s node: %d vhost: %d context: %s",
uri, context->node, context->vhost, context->context);
}
#endif

Expand Down
7 changes: 4 additions & 3 deletions native/mod_manager/mod_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,8 +1216,9 @@ static const proxy_worker_shared *read_shared_by_node(request_rec *r, nodeinfo_t
workers = (proxy_worker **)balancer->workers->elts;
for (j = 0; j < balancer->workers->nelts; j++, workers++) {
proxy_worker *worker = *workers;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "read_shared_by_node: Balancer %s worker %s, %s, %d",
balancer->s->name, worker->s->route, worker->s->hostname, worker->s->port);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"read_shared_by_node: Balancer %s worker (%d) %s, %s, %d", balancer->s->name, worker->s->index,
worker->s->route, worker->s->hostname, worker->s->port);
if (worker->s->port == port && strcmp(worker->s->hostname, node->mess.Host) == 0 &&
strcmp(worker->s->route, node->mess.JVMRoute) == 0) {
return worker->s;
Expand Down Expand Up @@ -1904,7 +1905,7 @@ static char *process_info(request_rec *r, int *errtype)

proxystat = read_shared_by_node(r, ou);
if (!proxystat) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_config: No proxystat, assum zeros");
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_config: No proxystat, assume zeros");
proxystat = apr_pcalloc(r->pool, sizeof(proxy_worker_shared));
}

Expand Down
14 changes: 10 additions & 4 deletions native/mod_proxy_cluster/mod_proxy_cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ static apr_status_t create_worker_reuse(proxy_server_conf *conf, const char *ptr
helper = *helper_ptr;
if (helper->index == -1) {
/* We are going to reuse a removed one */
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "create_worker_reuse: reusing removed worker for %s", url);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "create_worker_reuse: reusing removed worker (%d) for %s",
node->mess.id, url);
return APR_SUCCESS;
}

Expand Down Expand Up @@ -504,7 +505,7 @@ static apr_status_t create_worker(proxy_server_conf *conf, proxy_balancer *balan
}

/* No, it does not exist, so we will create a new one.
* Note that the ap_proxy_get_worker and ap_proxy_define_worker aren't symetrical, and
* Note that the ap_proxy_get_worker and ap_proxy_define_worker aren't symmetrical, and
* this leaks via the conf->pool
*/
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "create_worker: worker for %s Will create %d!!!", url,
Expand Down Expand Up @@ -797,13 +798,15 @@ static proxy_worker *get_worker_from_id_stat(const proxy_server_conf *conf, int
for (j = 0; j < balancer->workers->nelts; j++, ptrw = ptrw + sizew) {
proxy_worker **worker = (proxy_worker **)ptrw;
proxy_cluster_helper *helper = (proxy_cluster_helper *)(*worker)->context;

if ((*worker)->s == stat && helper->index == id) {
if (is_worker_empty(*worker)) {
return NULL;
} else {
return *worker;
}

return *worker;
}

if (helper->index == id) {
unpair_worker_node((*worker)->s, node);
helper->shared->index = -1;
Expand Down Expand Up @@ -1836,9 +1839,12 @@ static int proxy_node_isup(request_rec *r, int id, int load)
char *ptr;

if (node_storage->read_node(id, &node) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_cluster_isup: Can't read node with id %d.", id);
return HTTP_INTERNAL_SERVER_ERROR;
}
if (node->mess.remove) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy_cluster_isup: Node with id %d is marked for removal.", id);
return HTTP_INTERNAL_SERVER_ERROR;
}

Expand Down
45 changes: 22 additions & 23 deletions test/MODCLUSTER-640/mod_lbmethod_cluster.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,32 @@ LoadModule lbmethod_cluster_module modules/mod_lbmethod_cluster.so
LoadModule watchdog_module modules/mod_watchdog.so

LogLevel info
ServerName localhost
ServerName httpd-mod_proxy_cluster
ProxyPreserveHost On
UseNocanon On

<IfModule manager_module>
Listen 8090
ManagerBalancerName mycluster
Listen 8090
ManagerBalancerName mycluster

EnableWsTunnel
WSUpgradeHeader websocket
<VirtualHost *:8090>
EnableMCMPReceive
<Location />
Require ip 127.0.0.1
Require ip ::1
# This one is used in GH Actions
Require ip 172.17.
</Location>
<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
Require ip 127.0.0.1
Require ip ::1
# This one is used in GH Actions
Require ip 172.17.
</Location>
</VirtualHost>
</IfModule>
EnableWsTunnel
WSUpgradeHeader websocket

<VirtualHost *:8090>
EnableMCMPReceive
<Location />
# For podman, this gets changed to IP in httpd/run.sh
Require host .mod_proxy_cluster_testsuite_net
# _gateway is the hostname used through the docker port forward into the custom network
Require host _gateway
Require local
</Location>
<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
# _gateway is the hostname used through the docker port forward into the custom network
Require host _gateway
Require local
</Location>
</VirtualHost>

<Proxy "balancer://mycluster">
ProxySet growth=10
Expand Down
62 changes: 24 additions & 38 deletions test/MODCLUSTER-640/mod_proxy_cluster.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,34 @@ LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so

LogLevel info
UseNocanon On
ServerName localhost
ServerName httpd-mod_proxy_cluster
ProxyPreserveHost On

Listen 8090
ManagerBalancerName mycluster
WSUpgradeHeader websocket
EnableWsTunnel

<IfModule !lbmethod_cluster_module>
UseAlias On
</IfModule>
CreateBalancers 0
EnableOptions On

<IfModule manager_module>
Listen 8090
ManagerBalancerName mycluster
<VirtualHost *:8090>
EnableMCMPReceive
<Location />
# For podman, this gets changed to IP in httpd/run.sh
Require host .mod_proxy_cluster_testsuite_net
# _gateway is the hostname used through the docker port forward into the custom network
Require host _gateway
Require local
</Location>

<IfModule !lbmethod_cluster_module>
CreateBalancers 0
EnableOptions On
</IfModule>
<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
# _gateway is the hostname used through the docker port forward into the custom network
Require host _gateway
Require local
</Location>
</VirtualHost>

EnableWsTunnel
WSUpgradeHeader websocket
<VirtualHost *:8090>
EnableMCMPReceive
<Location />
Require ip 127.0.0.1
Require ip ::1
# This one is used in GH Actions
Require ip 172.17.
</Location>
<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
Require ip 127.0.0.1
Require ip ::1
# This one is used in GH Actions
Require ip 172.17.
</Location>
</VirtualHost>
</IfModule>

<IfModule lbmethod_cluster_module>
<Proxy "balancer://mycluster">
ProxySet growth=10
ProxySet lbmethod=cluster
</Proxy>
</IfModule>
LogLevel info
4 changes: 3 additions & 1 deletion test/MODCLUSTER-640/testit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ httpd_remove
rm -f nohup.out

MPC_CONF=${MPC_CONF:-MODCLUSTER-640/mod_proxy_cluster.conf}
MPC_NAME=MODCLUSTER-640 httpd_start
MPC_NAME=MODCLUSTER-640

httpd_start

# wait until httpd is started
httpd_wait_until_ready || exit 1
Expand Down
41 changes: 21 additions & 20 deletions test/MODCLUSTER-734/mod_lbmethod_cluster.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,32 @@ LoadModule watchdog_module modules/mod_watchdog.so
ProxyHCExpr in_maint {hc('body') !~ /Under maintenance/}
ModProxyClusterHCTemplate hcmethod=GET hcexpr=in_maint hcuri=/status.jsp

Maxnode 505
Maxhost 1010
Maxcontext 1100
Listen 8090
ManagerBalancerName mycluster
ServerName localhost
ServerName httpd-mod_proxy_cluster

<VirtualHost *:8090>
EnableMCMPReceive
<Location />
Require ip 127.0.0.
Require ip ::1
# This one is used in GH Actions
Require ip 172.17.
</Location>
<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
Require ip 127.0.0.
Require ip ::1
# This one is used in GH Actions
Require ip 172.17.
</Location>
EnableMCMPReceive
<Location />
# For podman, this gets changed to IP in httpd/run.sh
Require host .mod_proxy_cluster_testsuite_net
# _gateway is the hostname used through the docker port forward into the custom network
Require host _gateway
Require local
</Location>
<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
# _gateway is the hostname used through the docker port forward into the custom network
Require host _gateway
Require local
</Location>
</VirtualHost>

<Proxy "balancer://mycluster">
ProxySet growth=20
ProxySet lbmethod=cluster
ProxySet growth=20
ProxySet lbmethod=cluster
</Proxy>

Maxnode 505
Maxhost 1010
Maxcontext 1100
37 changes: 19 additions & 18 deletions test/MODCLUSTER-734/mod_proxy_cluster.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,27 @@ LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
ProxyHCExpr in_maint {hc('body') !~ /Under maintenance/}
ModProxyClusterHCTemplate hcmethod=GET hcexpr=in_maint hcuri=/status.jsp

Maxnode 505
Maxhost 1010
Maxcontext 1100
Listen 8090
ManagerBalancerName mycluster
ServerName localhost
ServerName httpd-mod_proxy_cluster

<VirtualHost *:8090>
EnableMCMPReceive
<Location />
Require ip 127.0.0.1
Require ip ::1
# This one is used in GH Actions
Require ip 172.17.
</Location>
<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
Require ip 127.0.0.1
Require ip ::1
# This one is used in GH Actions
Require ip 172.17.
</Location>
EnableMCMPReceive
<Location />
# For podman, this gets changed to IP in httpd/run.sh
Require host .mod_proxy_cluster_testsuite_net
# _gateway is the hostname used through the docker port forward into the custom network
Require host _gateway
Require local
</Location>
<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
# _gateway is the hostname used through the docker port forward into the custom network
Require host _gateway
Require local
</Location>
</VirtualHost>

Maxnode 505
Maxhost 1010
Maxcontext 1100
7 changes: 3 additions & 4 deletions test/MODCLUSTER-734/testit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ httpd_remove
# build httpd + mod_proxy_cluster
rm -f nohup.out

MPC_CONF=${MPC_CONF:-MODCLUSTER-734/mod_proxy_cluster.conf}
MPC_NAME=MODCLUSTER-734 httpd_start
MPC_NAME=MODCLUSTER-734 MPC_CONF=${MPC_CONF:-MODCLUSTER-734/mod_proxy_cluster.conf} httpd_start

# wait until httpd is started
httpd_wait_until_ready || exit 1

sleep 10

# start tomcat1 and tomcat2
tomcat_start_two
MPC_NAME=MODCLUSTER-734 tomcat_start_two

# wait until they are in mod_proxy_cluster tables
tomcat_wait_for_n_nodes 2
Expand All @@ -29,7 +28,7 @@ docker cp MODCLUSTER-734/ROOT_OK tomcat2:/usr/local/tomcat/webapps/ROOT

# after a while the health check will get the Under maintenance status.jsp
# and mark the node not OK.
sleep 15
sleep 20

curl -s -m 20 http://localhost:8090/mod_cluster_manager | grep "Status: NOTOK"
if [ $? -eq 0 ]; then
Expand Down
Loading