Bug 62372 - Load balancer byrequests required when bytraffic chosen
Summary: Load balancer byrequests required when bytraffic chosen
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy_balancer (show other bugs)
Version: 2.4.39
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-12 03:36 UTC by Eric Wilde
Modified: 2019-08-17 19:58 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Wilde 2018-05-12 03:36:33 UTC
I have an Apache httpd configuration file that includes:

  ProxySet lbmethod=bytraffic

Under httpd-2.4.29, this directive works fine, providing the config file also contains:

  LoadModule lbmethod_bytraffic_module \
    modules/mod_lbmethod_bytraffic.so

However, upon upgrading to httpd-2.4.33, with absolutely no other changes to anything, this same config file fails with:

  [proxy:crit] ... AH02432: Cannot find LB Method: byrequests

The problem can be fixed by adding this line to the config file:

  LoadModule lbmethod_byrequests_module \
    modules/mod_lbmethod_byrequests.so

This is new behavior.  The byrequests load balancer method was never required up until now.  It looks like somebody may have inadvertently added an incorrect requirement for byrequests when the "lbmethod=bytraffic" directive is included in the config file.  It would be nice if this could be fixed, so that one does not have to build and include the byrequests load balancer method along with the bytraffic method, if all they want to use is bytraffic.

If, on the other hand, this is now a legitimate requirement, it would be nice to document the fact that mod_lbmethod_byrequests.so is also required when you use the bytraffic method.

The build was from the 2.4.33 source, on CentOS 7, 1708, x86_64, using:

  ./configure --prefix=/usr/share/httpd-2.4 \
    --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr \
    --with-ssl=/usr/local \
    --enable-proxy --enable-rewrite --enable-ssl

The complete balancer definition from the config file is:

  <Proxy balancer://ics>
    BalancerMember http://10.100.0.248:8280
    BalancerMember http://10.100.0.247:8280 status=+H
    Require all granted
    ProxySet lbmethod=bytraffic
  </Proxy>
Comment 1 justin.bell 2019-04-02 13:53:48 UTC
I see the same issue

ProxySet lbmethod=bytraffic

[Mon Apr 01 16:23:51.969976 2019] [proxy:crit] [pid 98302:tid 140326682965760] AH02432: Cannot find LB Method: byrequests
[Mon Apr 01 16:23:51.970618 2019] [proxy_balancer:emerg] [pid 98302:tid 140326682965760] (22)Invalid argument: AH01183: Cannot share balancer

./httpd -v
Server version: Apache/2.4.38 (Unix)
Server built:   Mar  8 2019 16:56:45
Comment 2 justin.bell 2019-04-02 13:54:14 UTC
I see the same issue

ProxySet lbmethod=bytraffic

[Mon Apr 01 16:23:51.969976 2019] [proxy:crit] [pid 98302:tid 140326682965760] AH02432: Cannot find LB Method: byrequests
[Mon Apr 01 16:23:51.970618 2019] [proxy_balancer:emerg] [pid 98302:tid 140326682965760] (22)Invalid argument: AH01183: Cannot share balancer

./httpd -v
Server version: Apache/2.4.38 (Unix)
Server built:   Mar  8 2019 16:56:45
Comment 3 Jim Jagielski 2019-04-02 15:02:32 UTC
Please try the patch available at:

   https://svn.apache.org/viewvc?view=revision&revision=1856829

According to my testing, this fixes the issue.
Comment 4 justin.bell 2019-04-29 19:50:51 UTC
This is still present in
Comment 5 Ken Logan 2019-05-01 20:03:15 UTC
It appears that the reason mod_lbmethod_byrequests.so is required is because the configuration setting for lbmethod was not taking effect and the default method of requests was being used.

This is slightly different than the original report which was just about now needing mod_lbmethod_byrequests.so to be loaded even if not using it... in essence, it seems everyone is always using byrequests for the versions affected by this bug.

The patch looks like it addresses both problems.
Comment 6 justin.bell 2019-05-02 14:16:21 UTC
well, compilation fails with that patch

proxy_util.c:770: error: conflicting types for ‘ap_proxy_checkproxyblock’
mod_proxy.h:651: note: previous declaration of ‘ap_proxy_checkproxyblock’ was here
Comment 7 Christophe JAILLET 2019-05-02 17:29:42 UTC
(In reply to justin.bell from comment #6)
> well, compilation fails with that patch
> 
> proxy_util.c:770: error: conflicting types for ‘ap_proxy_checkproxyblock’
> mod_proxy.h:651: note: previous declaration of
> ‘ap_proxy_checkproxyblock’ was here

Looking at the patch itself in comment #3, having such a compilation error is really unlikely.
Their must be another issue somewhere else.
Did you apply any other changes?
Comment 8 justin.bell 2019-05-07 20:44:22 UTC
No other changes. No.

What else can I look at?
Comment 9 Christophe JAILLET 2019-05-08 07:03:12 UTC
This is really weird.

Could you cut'n'paste definition and declaration of "ap_proxy_checkproxyblock" (i.e. the lines reported by the compiler) + the few ones before and after them?

What version of the code are you patching?
Did you get it from httpd.a.o repository or was it provided by a distro?
Comment 10 justin.bell 2019-05-22 14:13:22 UTC
/* Return TRUE if string "str2" occurs literally in "str1" */
static int proxy_match_word(struct dirconn_entry *This, request_rec *r)
{
    const char *host = proxy_get_host_of_request(r);
    return host != NULL && ap_strstr_c(host, This->name) != NULL;
}

/* Backwards-compatible interface. */
PROXY_DECLARE(int) ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *conf,
                             apr_sockaddr_t *uri_addr)
{
    return ap_proxy_checkproxyblock2(r, conf, uri_addr->hostname, uri_addr);
}

#define MAX_IP_STR_LEN (46)




This is all downloaded from the Apache httpd website
Comment 11 Christophe JAILLET 2019-05-22 20:44:51 UTC
(In reply to justin.bell from comment #6)
> well, compilation fails with that patch
> 
> proxy_util.c:770: error: conflicting types for ‘ap_proxy_checkproxyblock’
> mod_proxy.h:651: note: previous declaration of
> ‘ap_proxy_checkproxyblock’ was here

Really weird to me.
Does compilation pass without the patch?
Comment 12 justin.bell 2019-05-23 14:24:28 UTC
yep, compiles just fine
Comment 13 Christophe JAILLET 2019-05-23 19:44:55 UTC
(In reply to justin.bell from comment #12)
> yep, compiles just fine

I applied r1856829 on top of latest 2.4.x and it compiles like a charm.
Really, the patch can not be related to your issue.

What compiler and version are you using?

I'll propose r1856829 for backport as it should be part of 2.4.x.
This will give a wider audience.
Comment 14 Christophe JAILLET 2019-08-17 19:58:57 UTC
This has been backported in 2.4.x in r1864005.

This is part of 2.4.40.