Uploaded image for project: 'mod_cluster'
  1. mod_cluster
  2. MODCLUSTER-309

mod_proxy_cluster not checking all available balancers (but only the first one) for an available route

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.2.2.Final
    • 1.2.1.Final
    • None
    • None

    Description

      I have an environment with two or more balancers.

      I want all the balancers to be available for all the virtualhosts (and maybe filter them using UseAlias). So I'm not configuring any ProxyPass directive but let mod_cluster create the balancers.

      During a simple test I noticed that session stickiness was not working for some requests.

      Enabling debug I noticed that mod_proxy_cluster:get_route_balancer failed to find a route so the worker was recalculated:

      [Tue May 15 16:39:46 2012] [debug] mod_proxy_cluster.c(2617): proxy_cluster_trans for 0 (null) (null) uri: /context01/jsp01.jsp args: (null) unparsed_uri: /context01/jsp01.jsp
      [Tue May 15 16:39:46 2012] [debug] mod_proxy_cluster.c(2441): cluster: balancer://balancer01 Found value 7tTdLpqWIZjDLcyBrn25tCc9.eb5376bd-c45b-38d1-97e0-c16b97f471d1 for stickysession JSESSIONID|jsessionid
      [Tue May 15 16:39:46 2012] [debug] mod_proxy_cluster.c(2441): cluster: balancer://balancer01 Found value 7tTdLpqWIZjDLcyBrn25tCc9.eb5376bd-c45b-38d1-97e0-c16b97f471d1 for stickysession JSESSIONID|jsessionid
      [Tue May 15 16:39:46 2012] [debug] mod_proxy_cluster.c(2675): proxy_cluster_trans using balancer02 uri: proxy:balancer://balancer02/context01/jsp01.jsp
      [Tue May 15 16:39:46 2012] [debug] mod_proxy_cluster.c(2708): proxy_cluster_canon url: //balancer02/context01/jsp01.jsp
      [Tue May 15 16:39:46 2012] [debug] mod_proxy_cluster.c(3140): proxy_cluster_pre_request: url balancer://balancer02/context01/jsp01.jsp
      [Tue May 15 16:39:46 2012] [debug] mod_proxy_cluster.c(2880): cluster:No route found
      [Tue May 15 16:39:46 2012] [debug] mod_proxy_cluster.c(1854): proxy: Entering byrequests for CLUSTER (balancer://balancer02)
      [Tue May 15 16:39:46 2012] [debug] mod_proxy_cluster.c(1972): proxy: byrequests balancer DONE (ajp://192.168.122.22:8359)
      [Tue May 15 16:39:46 2012] [debug] mod_proxy_cluster.c(3368): proxy_cluster_pre_request: balancer (balancer://balancer02) worker (ajp://192.168.122.22:8359) rewritten to ajp://192.168.122.22:8359/context01/jsp01.jsp

      Looking at the code looks like mod_cluster checks only the first balancer and, if it does not find any valid route it will give up without retrying the other available balancers.

      With this patch it's now checking all the available balancers:

       
      Index: mod_proxy_cluster/mod_proxy_cluster.c
      ===================================================================
      --- mod_proxy_cluster/mod_proxy_cluster.c	(revision 838)
      +++ mod_proxy_cluster/mod_proxy_cluster.c	(working copy)
      @@ -2453,7 +2453,7 @@
                       /* Nice we have a route, but make sure we have to serve it */
                       int *nodes = find_node_context_host(r, balancer, route, use_alias, vhost_table, context_table);
                       if (nodes == NULL)
      -                    return NULL; /* we can't serve context/host for the request */
      +                    continue; /* we can't serve context/host for the request with this balancer*/
                   }
                   if (route && *route) {
                       char *domain = NULL;
      

      and this is the log after this possible fix:

      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(2617): proxy_cluster_trans for 0 (null) (null) uri: /context01/ args: (null) unparsed_uri: /context01/
      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(2441): cluster: balancer://balancer02 Found value Frjih6gBZzDUg+RFgeUvKJfy.9cedb7e1-5c20-3da7-bd17-9d0bc99b49d3 for stickysession JSESSIONID|jsessionid
      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(2441): cluster: balancer://balancer01 Found value Frjih6gBZzDUg+RFgeUvKJfy.9cedb7e1-5c20-3da7-bd17-9d0bc99b49d3 for stickysession JSESSIONID|jsessionid
      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(2461): cluster: Found route 9cedb7e1-5c20-3da7-bd17-9d0bc99b49d3
      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(2377): find_nodedomain: finding node for 9cedb7e1-5c20-3da7-bd17-9d0bc99b49d3: balancer01
      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(2470): cluster: Found balancer balancer01 for 9cedb7e1-5c20-3da7-bd17-9d0bc99b49d3
      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(2675): proxy_cluster_trans using balancer01 uri: proxy:balancer://balancer01/context01/
      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(2708): proxy_cluster_canon url: //balancer01/context01/
      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(3140): proxy_cluster_pre_request: url balancer://balancer01/context01/
      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(2876): cluster: Using route 9cedb7e1-5c20-3da7-bd17-9d0bc99b49d3
      [Tue May 15 16:38:36 2012] [debug] mod_proxy_cluster.c(3368): proxy_cluster_pre_request: balancer (balancer://balancer01) worker (ajp://192.168.122.22:8259) rewritten to ajp://192.168.122.22:8259/context01/

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-jclere Jean-Frederic Clere
              simone.gotti_jira Simone Gotti (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: