threads / patch / 34072

patch, 4 partsgit http tests with apache 2.4

Subject: [RFH/PATCH 0/4] git http tests with apache 2.4

## tl;dr

7 messages between Jun 9, 2013 and Jun 14, 2013. Diffs are folded; open one to read it.

replies: 6people: 2as markdown or json

Jeff King· Jun 9, 2013, 08:07 UTC · lore

Apache 2.4 recently shipped in Debian unstable, and I noticed that all of the git httpd tests stopped working. It turns out that some configuration directives have changed between 2.2 and 2.4, and the httpd server would not start at all.

With this series, the tests run again (for me, at least). The "<IfVersion>" checks hopefully mean that there are no regressions for people running 2.2 and lower.

However, the final patch is very unsatisfactory. We have to pick an MPM module to mention in the config, but we don't have any idea what's available. I suspect what I have provided will work on most Unix-ish systems. Under Windows, there is a totally different MPM. But I am not sure that our http tests run at all on Windows, as we seem to check in lib-httpd.sh for a Unix-ish apache module path.

As far as I know, Apache does not have a "try to load this module and fallback" directive. We could perhaps look in the module directory and try to do something clever in the shell before starting Apache. Advice from Apache gurus is welcome.

  [1/4]: t/lib-httpd/apache.conf: do not use LockFile in apache >= 2.4
  [2/4]: t/lib-httpd/apache.conf: load extra auth modules in apache 2.4
  [3/4]: t/lib-httpd/apache.conf: load compat access module in apache 2.4
  [4/4]: t/lib-httpd/apache.conf: configure an MPM module for apache 2.4
-Peff
Jeff King· Jun 9, 2013, 08:07 UTC · re: Jeff King · lore

[PATCH 1/4] t/lib-httpd/apache.conf: do not use LockFile in apache >= 2.4

The LockFile directive from earlier versions of apache has been replaced by the Mutex directive. The latter seems to give sane defaults and does not need any specific customization, so we can get away with just adding a version check to the use of LockFile.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/lib-httpd/apache.conf | 2 ++
 1 file changed, 2 insertions(+)
Show changes to t/lib-httpd/apache.conf +2 −0
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index b5bce45..38699bb 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -1,5 +1,7 @@ LockFile accept.lock
 ServerName dummy
+<IfVersion < 2.4>
 LockFile accept.lock
+</IfVersion>
 PidFile httpd.pid
 DocumentRoot www
 LogFormat "%h %l %u %t \"%r\" %>s %b" common
-- 
1.8.3.rc2.14.g7eee6b3
Jeff King· Jun 9, 2013, 08:08 UTC · re: Jeff King · lore

[PATCH 2/4] t/lib-httpd/apache.conf: load extra auth modules in apache 2.4

In apache 2.4, the "Auth*" and "Require" directives have moved into the authn_core and authz_core modules, respectively.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/lib-httpd/apache.conf | 9 +++++++++
 1 file changed, 9 insertions(+)
Show changes to t/lib-httpd/apache.conf +9 −0
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 38699bb..1d3615b 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -47,6 +47,15 @@ ErrorLog error.log
 </IfModule>
 </IfVersion>
 
+<IfVersion >= 2.4>
+<IfModule !mod_authn_core.c>
+	LoadModule authn_core_module modules/mod_authn_core.so
+</IfModule>
+<IfModule !mod_authz_core.c>
+	LoadModule authz_core_module modules/mod_authz_core.so
+</IfModule>
+</IfVersion>
+
 PassEnv GIT_VALGRIND
 PassEnv GIT_VALGRIND_OPTIONS
 
-- 
1.8.3.rc2.14.g7eee6b3
Jeff King· Jun 9, 2013, 08:08 UTC · re: Jeff King · lore

[PATCH 3/4] t/lib-httpd/apache.conf: load compat access module in apache 2.4

In apache 2.4, the "Order" directive has gone away in favor of a new system in mod_authz_host. However, since we want our config file to remain compatible across multiple Apache versions, we can use mod_access_compat to keep using the older style.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/lib-httpd/apache.conf | 3 +++
 1 file changed, 3 insertions(+)
Show changes to t/lib-httpd/apache.conf +3 −0
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 1d3615b..4883b8c 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -54,6 +54,9 @@ ErrorLog error.log
 <IfModule !mod_authz_core.c>
 	LoadModule authz_core_module modules/mod_authz_core.so
 </IfModule>
+<IfModule !mod_access_compat.c>
+	LoadModule access_compat_module modules/mod_access_compat.so
+</IfModule>
 </IfVersion>
 
 PassEnv GIT_VALGRIND
-- 
1.8.3.rc2.14.g7eee6b3
Jeff King· Jun 9, 2013, 08:09 UTC · re: Jeff King · lore

[PATCH 4/4] t/lib-httpd/apache.conf: configure an MPM module for apache 2.4

Versions of Apache before 2.4 always had a "MultiProcessing Module" (MPM) statically built in, which manages the worker threads/processes. We do not care which one, as it is largely a performance issue, and we put only a light load on the server during our testing.

As of Apache 2.4, the MPM module is loadable just like any other module, but exactly one such module must be loaded. On a system where the MPMs are compiled dynamically (e.g., Debian unstable), this means that our test Apache server will not start unless we provide the appropriate configuration.

Unfortunately, we do not actually know which MPM modules are available or appropriate for the system on which the tests are running. This patch picks the "prefork" module, as it is likely to be available on all Unix-like systems.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/lib-httpd/apache.conf | 3 +++
 1 file changed, 3 insertions(+)
Show changes to t/lib-httpd/apache.conf +3 −0
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 4883b8c..56ae548 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -57,6 +57,9 @@ ErrorLog error.log
 <IfModule !mod_access_compat.c>
 	LoadModule access_compat_module modules/mod_access_compat.so
 </IfModule>
+<IfModule !mod_mpm_prefork.c>
+	LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
+</IfModule>
 </IfVersion>
 
 PassEnv GIT_VALGRIND
-- 
1.8.3.rc2.14.g7eee6b3
Junio C Hamano· Jun 14, 2013, 17:32 UTC · re: Jeff King · lore

Re: [RFH/PATCH 0/4] git http tests with apache 2.4

Jeff King <peff@peff.net> writes:
Show 15 quoted lines
> Apache 2.4 recently shipped in Debian unstable, and I noticed that all
> of the git httpd tests stopped working. It turns out that some
> configuration directives have changed between 2.2 and 2.4, and the httpd
> server would not start at all.
>
> With this series, the tests run again (for me, at least). The
> "<IfVersion>" checks hopefully mean that there are no regressions for
> people running 2.2 and lower.
>
> However, the final patch is very unsatisfactory. We have to pick an MPM
> module to mention in the config, but we don't have any idea what's
> available. I suspect what I have provided will work on most Unix-ish
> systems. Under Windows, there is a totally different MPM. But I am not
> sure that our http tests run at all on Windows, as we seem to check in
> lib-httpd.sh for a Unix-ish apache module path.

Thanks. I think the final one, while it may be unsatisfactory, is a reasonable (or "least bad") compromise, at least for now. I do not think of a better way, without adding "if you want customization, write a snippet to be included in the configuration used during the test", which feels way overkill.

Show 12 quoted lines
>
> As far as I know, Apache does not have a "try to load this module and
> fallback" directive. We could perhaps look in the module directory and
> try to do something clever in the shell before starting Apache. Advice
> from Apache gurus is welcome.
>
>   [1/4]: t/lib-httpd/apache.conf: do not use LockFile in apache >= 2.4
>   [2/4]: t/lib-httpd/apache.conf: load extra auth modules in apache 2.4
>   [3/4]: t/lib-httpd/apache.conf: load compat access module in apache 2.4
>   [4/4]: t/lib-httpd/apache.conf: configure an MPM module for apache 2.4
>
> -Peff
Jeff King· Jun 14, 2013, 21:58 UTC · re: Junio C Hamano · lore

Re: [RFH/PATCH 0/4] git http tests with apache 2.4

On Fri, Jun 14, 2013 at 10:32:57AM -0700, Junio C Hamano wrote:
Show 12 quoted lines
> > However, the final patch is very unsatisfactory. We have to pick an MPM
> > module to mention in the config, but we don't have any idea what's
> > available. I suspect what I have provided will work on most Unix-ish
> > systems. Under Windows, there is a totally different MPM. But I am not
> > sure that our http tests run at all on Windows, as we seem to check in
> > lib-httpd.sh for a Unix-ish apache module path.
> 
> Thanks.  I think the final one, while it may be unsatisfactory, is a
> reasonable (or "least bad") compromise, at least for now.  I do not
> think of a better way, without adding "if you want customization,
> write a snippet to be included in the configuration used during the
> test", which feels way overkill.

Yeah, we may have to go there. My feeling on it (and why I posted it as-is) is that it improves the situation for some people, and should be no worse for anyone else. Therefore people who are on 2.4 and are still broken after this series can speak up and show us the exact breakage and fix they need without us having to guess.

-Peff

← back to recent threads