Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/apache/, www-servers/apache/files/
Date: Fri, 24 Aug 2018 00:56:29
Message-Id: 1535072144.f3fdd0e0b70833ffebc5a45732a48eb6a359fce5.whissi@gentoo
1 commit: f3fdd0e0b70833ffebc5a45732a48eb6a359fce5
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 24 00:55:44 2018 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 24 00:55:44 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f3fdd0e0
7
8 www-servers/apache: fix the issue with lbmethod_* load order
9
10 Closes: https://bugs.gentoo.org/663312
11 Package-Manager: Portage-2.3.48, Repoman-2.3.10
12 RepoMan-Options: --force
13
14 ...he-2.4.34-r1.ebuild => apache-2.4.34-r2.ebuild} | 1 +
15 .../apache/files/apache-2.4.34-PR62557.patch | 216 +++++++++++++++++++++
16 2 files changed, 217 insertions(+)
17
18 diff --git a/www-servers/apache/apache-2.4.34-r1.ebuild b/www-servers/apache/apache-2.4.34-r2.ebuild
19 similarity index 99%
20 rename from www-servers/apache/apache-2.4.34-r1.ebuild
21 rename to www-servers/apache/apache-2.4.34-r2.ebuild
22 index d9a72b6f05c..db0368ea9f7 100644
23 --- a/www-servers/apache/apache-2.4.34-r1.ebuild
24 +++ b/www-servers/apache/apache-2.4.34-r2.ebuild
25 @@ -151,6 +151,7 @@ REQUIRED_USE="apache2_modules_http2? ( ssl )
26
27 PATCHES=(
28 "${FILESDIR}/${PN}-2.4.34-suexec_parallel_install.patch" #661358
29 + "${FILESDIR}"/${P}-PR62557.patch #663312
30 )
31
32 pkg_setup() {
33
34 diff --git a/www-servers/apache/files/apache-2.4.34-PR62557.patch b/www-servers/apache/files/apache-2.4.34-PR62557.patch
35 new file mode 100644
36 index 00000000000..d95a9864d1b
37 --- /dev/null
38 +++ b/www-servers/apache/files/apache-2.4.34-PR62557.patch
39 @@ -0,0 +1,216 @@
40 +From d7713339dbde7cfa4cfc9914f683b4644dcab92e Mon Sep 17 00:00:00 2001
41 +From: Ruediger Pluem <rpluem@××××××.org>
42 +Date: Fri, 20 Jul 2018 19:27:31 +0000
43 +Subject: [PATCH] * mod_proxy: Remove load order and link dependency between
44 + mod_lbmethod_* modules and mod_proxy by providing mod_proxy's
45 + ap_proxy_balancer_get_best_worker as an optional function.
46 +
47 +PR: 62557
48 +
49 +
50 +git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1836381 13f79535-47bb-0310-9956-ffa450edef68
51 +---
52 + CHANGES | 3 +++
53 + include/ap_mmn.h | 5 +++-
54 + modules/proxy/balancers/mod_lbmethod_bybusyness.c | 28 ++++++++++++++++++++++-
55 + modules/proxy/balancers/mod_lbmethod_byrequests.c | 28 ++++++++++++++++++++++-
56 + modules/proxy/balancers/mod_lbmethod_bytraffic.c | 28 ++++++++++++++++++++++-
57 + modules/proxy/mod_proxy.h | 8 +++++++
58 + modules/proxy/proxy_util.c | 1 +
59 + 7 files changed, 97 insertions(+), 4 deletions(-)
60 +
61 +--- apache2.orig/modules/proxy/balancers/mod_lbmethod_bybusyness.c
62 ++++ apache2/modules/proxy/balancers/mod_lbmethod_bybusyness.c
63 +@@ -22,6 +22,9 @@
64 +
65 + module AP_MODULE_DECLARE_DATA lbmethod_bybusyness_module;
66 +
67 ++static APR_OPTIONAL_FN_TYPE(ap_proxy_balancer_get_best_worker)
68 ++ *ap_proxy_balancer_get_best_worker_fn = NULL;
69 ++
70 + static int is_best_bybusyness(proxy_worker *current, proxy_worker *prev_best, void *baton)
71 + {
72 + int *total_factor = (int *)baton;
73 +@@ -44,7 +47,7 @@ static proxy_worker *find_best_bybusynes
74 + {
75 + int total_factor = 0;
76 + proxy_worker *worker =
77 +- ap_proxy_balancer_get_best_worker(balancer, r, is_best_bybusyness,
78 ++ ap_proxy_balancer_get_best_worker_fn(balancer, r, is_best_bybusyness,
79 + &total_factor);
80 +
81 + if (worker) {
82 +@@ -82,9 +85,32 @@ static const proxy_balancer_method bybus
83 + NULL
84 + };
85 +
86 ++/* post_config hook: */
87 ++static int lbmethod_bybusyness_post_config(apr_pool_t *pconf, apr_pool_t *plog,
88 ++ apr_pool_t *ptemp, server_rec *s)
89 ++{
90 ++
91 ++ /* lbmethod_bybusyness_post_config() will be called twice during startup. So, don't
92 ++ * set up the static data the 1st time through. */
93 ++ if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) {
94 ++ return OK;
95 ++ }
96 ++
97 ++ ap_proxy_balancer_get_best_worker_fn =
98 ++ APR_RETRIEVE_OPTIONAL_FN(ap_proxy_balancer_get_best_worker);
99 ++ if (!ap_proxy_balancer_get_best_worker_fn) {
100 ++ ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO()
101 ++ "mod_proxy must be loaded for mod_lbmethod_bybusyness");
102 ++ return !OK;
103 ++ }
104 ++
105 ++ return OK;
106 ++}
107 ++
108 + static void register_hook(apr_pool_t *p)
109 + {
110 + ap_register_provider(p, PROXY_LBMETHOD, "bybusyness", "0", &bybusyness);
111 ++ ap_hook_post_config(lbmethod_bybusyness_post_config, NULL, NULL, APR_HOOK_MIDDLE);
112 + }
113 +
114 + AP_DECLARE_MODULE(lbmethod_bybusyness) = {
115 +--- apache2.orig/modules/proxy/balancers/mod_lbmethod_byrequests.c
116 ++++ apache2/modules/proxy/balancers/mod_lbmethod_byrequests.c
117 +@@ -22,6 +22,9 @@
118 +
119 + module AP_MODULE_DECLARE_DATA lbmethod_byrequests_module;
120 +
121 ++static APR_OPTIONAL_FN_TYPE(ap_proxy_balancer_get_best_worker)
122 ++ *ap_proxy_balancer_get_best_worker_fn = NULL;
123 ++
124 + static int is_best_byrequests(proxy_worker *current, proxy_worker *prev_best, void *baton)
125 + {
126 + int *total_factor = (int *)baton;
127 +@@ -81,7 +84,7 @@ static proxy_worker *find_best_byrequest
128 + request_rec *r)
129 + {
130 + int total_factor = 0;
131 +- proxy_worker *worker = ap_proxy_balancer_get_best_worker(balancer, r, is_best_byrequests, &total_factor);
132 ++ proxy_worker *worker = ap_proxy_balancer_get_best_worker_fn(balancer, r, is_best_byrequests, &total_factor);
133 +
134 + if (worker) {
135 + worker->s->lbstatus -= total_factor;
136 +@@ -123,6 +126,28 @@ static const proxy_balancer_method byreq
137 + NULL
138 + };
139 +
140 ++/* post_config hook: */
141 ++static int lbmethod_byrequests_post_config(apr_pool_t *pconf, apr_pool_t *plog,
142 ++ apr_pool_t *ptemp, server_rec *s)
143 ++{
144 ++
145 ++ /* lbmethod_byrequests_post_config() will be called twice during startup. So, don't
146 ++ * set up the static data the 1st time through. */
147 ++ if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) {
148 ++ return OK;
149 ++ }
150 ++
151 ++ ap_proxy_balancer_get_best_worker_fn =
152 ++ APR_RETRIEVE_OPTIONAL_FN(ap_proxy_balancer_get_best_worker);
153 ++ if (!ap_proxy_balancer_get_best_worker_fn) {
154 ++ ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO()
155 ++ "mod_proxy must be loaded for mod_lbmethod_byrequests");
156 ++ return !OK;
157 ++ }
158 ++
159 ++ return OK;
160 ++}
161 ++
162 + static void register_hook(apr_pool_t *p)
163 + {
164 + /* Only the mpm_winnt has child init hook handler.
165 +@@ -130,6 +155,7 @@ static void register_hook(apr_pool_t *p)
166 + * initializes and after the mod_proxy
167 + */
168 + ap_register_provider(p, PROXY_LBMETHOD, "byrequests", "0", &byrequests);
169 ++ ap_hook_post_config(lbmethod_byrequests_post_config, NULL, NULL, APR_HOOK_MIDDLE);
170 + }
171 +
172 + AP_DECLARE_MODULE(lbmethod_byrequests) = {
173 +--- apache2.orig/modules/proxy/balancers/mod_lbmethod_bytraffic.c
174 ++++ apache2/modules/proxy/balancers/mod_lbmethod_bytraffic.c
175 +@@ -22,6 +22,9 @@
176 +
177 + module AP_MODULE_DECLARE_DATA lbmethod_bytraffic_module;
178 +
179 ++static APR_OPTIONAL_FN_TYPE(ap_proxy_balancer_get_best_worker)
180 ++ *ap_proxy_balancer_get_best_worker_fn = NULL;
181 ++
182 + static int is_best_bytraffic(proxy_worker *current, proxy_worker *prev_best, void *baton)
183 + {
184 + apr_off_t *min_traffic = (apr_off_t *)baton;
185 +@@ -59,7 +62,7 @@ static proxy_worker *find_best_bytraffic
186 + {
187 + apr_off_t min_traffic = 0;
188 +
189 +- return ap_proxy_balancer_get_best_worker(balancer, r, is_best_bytraffic,
190 ++ return ap_proxy_balancer_get_best_worker_fn(balancer, r, is_best_bytraffic,
191 + &min_traffic);
192 + }
193 +
194 +@@ -93,6 +96,28 @@ static const proxy_balancer_method bytra
195 + NULL
196 + };
197 +
198 ++/* post_config hook: */
199 ++static int lbmethod_bytraffic_post_config(apr_pool_t *pconf, apr_pool_t *plog,
200 ++ apr_pool_t *ptemp, server_rec *s)
201 ++{
202 ++
203 ++ /* lbmethod_bytraffic_post_config() will be called twice during startup. So, don't
204 ++ * set up the static data the 1st time through. */
205 ++ if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) {
206 ++ return OK;
207 ++ }
208 ++
209 ++ ap_proxy_balancer_get_best_worker_fn =
210 ++ APR_RETRIEVE_OPTIONAL_FN(ap_proxy_balancer_get_best_worker);
211 ++ if (!ap_proxy_balancer_get_best_worker_fn) {
212 ++ ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO()
213 ++ "mod_proxy must be loaded for mod_lbmethod_bytraffic");
214 ++ return !OK;
215 ++ }
216 ++
217 ++ return OK;
218 ++}
219 ++
220 + static void register_hook(apr_pool_t *p)
221 + {
222 + /* Only the mpm_winnt has child init hook handler.
223 +@@ -100,6 +125,7 @@ static void register_hook(apr_pool_t *p)
224 + * initializes and after the mod_proxy
225 + */
226 + ap_register_provider(p, PROXY_LBMETHOD, "bytraffic", "0", &bytraffic);
227 ++ ap_hook_post_config(lbmethod_bytraffic_post_config, NULL, NULL, APR_HOOK_MIDDLE);
228 + }
229 +
230 + AP_DECLARE_MODULE(lbmethod_bytraffic) = {
231 +--- apache2.orig/modules/proxy/mod_proxy.h
232 ++++ apache2/modules/proxy/mod_proxy.h
233 +@@ -846,6 +846,14 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_b
234 + request_rec *r,
235 + proxy_is_best_callback_fn_t *is_best,
236 + void *baton);
237 ++/*
238 ++ * Needed by the lb modules.
239 ++ */
240 ++APR_DECLARE_OPTIONAL_FN(proxy_worker *, ap_proxy_balancer_get_best_worker,
241 ++ (proxy_balancer *balancer,
242 ++ request_rec *r,
243 ++ proxy_is_best_callback_fn_t *is_best,
244 ++ void *baton));
245 +
246 + /**
247 + * Find the shm of the worker as needed
248 +--- apache2.orig/modules/proxy/proxy_util.c
249 ++++ apache2/modules/proxy/proxy_util.c
250 +@@ -4028,4 +4028,5 @@ void proxy_util_register_hooks(apr_pool_
251 + {
252 + APR_REGISTER_OPTIONAL_FN(ap_proxy_retry_worker);
253 + APR_REGISTER_OPTIONAL_FN(ap_proxy_clear_connection);
254 ++ APR_REGISTER_OPTIONAL_FN(ap_proxy_balancer_get_best_worker);
255 + }