Bug 54613 - httpd assumes apr with APR_HAS_THREADS true
Summary: httpd assumes apr with APR_HAS_THREADS true
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Build (show other bugs)
Version: 2.4.4
Hardware: PC FreeBSD
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2013-02-27 14:40 UTC by Conor McCarthy
Modified: 2015-03-03 18:09 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Conor McCarthy 2013-02-27 14:40:20 UTC
TLDR: apache-2.4 cannot be compiled on FreeBSD<=5.2, this is not clearly documented, the requirements for threading support are not clearly documented, "configure" issues no warning or errors, the compile step fails inelegantly.

The unconditional presence of the type "apr_thread_mutex_t" in the "request_rec" struct member "invoke_mtx" (include/httpd.h) means that httpd will only compile when apr is built with APR_HAS_THREADS defined non-zero. This member was not present in 2.2.x.

Observed on 
- x86 FreeBSD-4.11 (don't ask)
- httpd-2.4.4
- apr-1.4.6
- apr-util-1.5.1

This means that httpd-2.4.4 can be configured successfully with "--with-mpm=prefork" but the wheels come off part way through the compile.
(apr support for threading support on FreeBSD is limited to >=5.2, specifically kern.osreldate >= 502102 when libpthread/libkse support was enabled)

The only place this structure member is used in core (modules/http/http_request.c) *is* guarded with "#if APR_HAS_THREADS", so it appears safe to fix, but I do not know to what extent this structure is used in the ABI.
(The experimental mod_dialup also uses it, it implicitly requires threading.)

mod_proxy's "proxy_worker" and "proxy_balancer" have a similar issue. mod_proxy appears to require threads, though it does not check for apr support, and the documentation (http://httpd.apache.org/docs/2.4/mod/mod_proxy.html) still refers to prefork MPM support. I also mention this because server/core.c includes mod_proxy.h even if no proxy module is enabled.
Comment 1 Eric Covener 2013-02-27 16:40:00 UTC
Fair to say any environment where the request_rec offsets would change as a result of #if APR_HAS_THREADS are today not compiling at all?  In such a case it could be changed without a major ABI bump.
Comment 2 Eric Covener 2015-03-02 17:48:06 UTC
Thanks for the report, finally fixed in trunk.
Comment 3 Conor McCarthy 2015-03-03 18:09:30 UTC
Great, thanks! I'll keep an eye out for 2.4.13 and check it builds as expected.