Bug 50592 - httpd dumps core on an IPv6 only system
Summary: httpd dumps core on an IPv6 only system
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.2.17
Hardware: PC FreeBSD
: P2 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2011-01-15 13:47 UTC by Frank Volf
Modified: 2018-03-12 22:33 UTC (History)
0 users



Attachments
patch for IPv6 only systems (628 bytes, patch)
2011-06-25 14:45 UTC, 2510
Details | Diff
patch for IPv6 only systems (replacing APR_INET by APR_UNSPEC, refer comment #6) (751 bytes, patch)
2011-07-05 11:45 UTC, 2510
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Volf 2011-01-15 13:47:11 UTC
Apache HTTPD dumps core on a FreeBSD-8.2-STABLE system in an IPv6 only jail when starting.

    six# /usr/local/etc/rc.d/apache22 start
    Performing sanity check on apache22 configuration:
    [Sat Jan 15 15:27:54 2011] [crit] [Sat Jan 15 15:27:54 2011] file config.c, line 1982, assertion "rv == APR_SUCCESS" failed
    Abort trap (core dumped)
    Starting apache22.
    [Sat Jan 15 15:27:54 2011] [crit] [Sat Jan 15 15:27:54 2011] file config.c, line 1982, assertion "rv == APR_SUCCESS" failed
    Abort trap (core dumped)
    /usr/local/etc/rc.d/apache22: WARNING: failed to start apache22

The apache version is apache-2.2.17_1 from the FreeBSD port collection using all the default options:

six# httpd -V

    Server version: Apache/2.2.17 (FreeBSD)
    Server built: Jan 15 2011 14:48:51
    Server's Module Magic Number: 20051115:25
    Server loaded: APR 1.4.2, APR-Util 1.3.10
    Compiled using: APR 1.4.2, APR-Util 1.3.10
    Architecture: 32-bit
    Server MPM: Prefork
    threaded: no
    forked: yes (variable process count)
    Server compiled with....
    -D APACHE_MPM_DIR="server/mpm/prefork"
    -D APR_HAS_SENDFILE
    -D APR_HAS_MMAP
    -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
    -D APR_USE_FLOCK_SERIALIZE
    -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
    -D APR_HAS_OTHER_CHILD
    -D AP_HAVE_RELIABLE_PIPED_LOGS
    -D DYNAMIC_MODULE_LIMIT=128
    -D HTTPD_ROOT="/usr/local"
    -D SUEXEC_BIN="/usr/local/bin/suexec"
    -D DEFAULT_PIDLOG="/var/run/httpd.pid"
    -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
    -D DEFAULT_LOCKFILE="/var/run/accept.lock"
    -D DEFAULT_ERRORLOG="logs/error_log"
    -D AP_TYPES_CONFIG_FILE="etc/apache22/mime.types"
    -D SERVER_CONFIG_FILE="etc/apache22/httpd.conf"
    six#

The httpd.conf file is pretty straightforward as well, for space reasons I only include the differences compared to the httpd.conf from the distribution:

    six# diff -u0 httpd.conf.dist httpd.conf
    --- httpd.conf.dist 2011-01-12 02:18:09.000000000 +0100
    +++ httpd.conf 2011-01-15 14:44:31.000000000 +0100
    @@ -40 +40 @@
    -Listen 80
    +Listen [2001:980:1312:6::1]:80
    @@ -104,0 +105 @@
    +LoadModule php5_module libexec/apache22/libphp5.so
    @@ -139 +140 @@
    -ServerAdmin you@example.com
    +ServerAdmin www@deze.org
    @@ -148 +149 @@
    -#ServerName www.example.com:80
    +ServerName six.ipv6.deze.org:80
    @@ -216 +217 @@
    - DirectoryIndex index.html
    + DirectoryIndex index.html index.php
    @@ -380,0 +382,4 @@
    +
    + # For PHP
    + AddType application/x-httpd-php .php
    + AddType application/x-httpd-php-source .phps

The hostname of the jail is resolvable (forward and reverse) via DNS and is also in /etc/hosts.
But the hostname has only an AAAA record, but no A record in DNS.


    six# host -6 six.ipv6.deze.org
    six.ipv6.deze.org has IPv6 address 2001:980:1312:6::1
    six# host 2001:980:1312:6::1
    1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.6.0.0.0.2.1.3.1.0.8.9.0.1.0.0.2.ip6.arpa domain name pointer six.ipv6.deze.org.


I posted this problem on the apache-users mailing list, and it was suggested to file bug because:

"IIUC apache is trying to setup the skeleton vhost config for the base
server and asking the system for a sockaddr for IPV4 INADDR_ANY (we
haven't read the config enough to even know the base configs
ServerName).

I'd suggest opening a bug, I think httpd could at least ask APR/the OS
to give up an IPV6 INADDRY_ANY before asserting."
Comment 1 Nick Kew 2011-01-15 23:23:48 UTC
Trunk fix in r1059472 to exit cleanly with an error message on failure.
Comment 2 Nick Kew 2011-01-15 23:28:23 UTC
Hmm, actually I'd better not mark my patch as a fix, as you suggest a possibly-better fix.  I won't attempt that unless I can reproduce the behaviour to test a fix.
Comment 3 M8R-3mye921 2011-06-06 19:09:05 UTC
Has this been investigated at all? This issue still exists in 2.2.19, tested on FreeBSD 7.4-RELEASE-p2 in an IPv6 only jail. Configuring the jail with an IPv4 address as well allows Apache to start. My expected behavior is that Apache actually starts, it should have no reason not to.

Output of -V for me:

Server version: Apache/2.2.19 (Unix)
Server built:   Jun  6 2011 12:56:46
Server's Module Magic Number: 20051115:28
Server loaded:  APR 1.4.5, APR-Util 1.3.12
Compiled using: APR 1.4.5, APR-Util 1.3.12
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_FLOCK_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr/local/www"
 -D SUEXEC_BIN="/usr/local/www/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
Comment 4 2510 2011-06-25 14:45:00 UTC
Created attachment 27206 [details]
patch for IPv6 only systems

Same problem on FreeBSD 8.2-RELEASE with IPv6 only jails.
Patch for httpd-2.2.19 attached.
Comment 5 Frank Volf 2011-07-02 09:41:37 UTC
(In reply to comment #4)
> Created attachment 27206 [details]
> patch for IPv6 only systems
> 
> Same problem on FreeBSD 8.2-RELEASE with IPv6 only jails.
> Patch for httpd-2.2.19 attached.

I confirm that this patch solves my problem. HTTPD now starts and seems to run normal.

Please include in the next release of apache!

Many thanks,

Frank
Comment 6 Joe Orton 2011-07-05 10:08:22 UTC
Thanks for the patch.

I am not sure why that code needs to use a specific address family.  Can you check it also works if you change the APR_INET to APR_UNSPEC, instead of your patch to fall back on _INET6?
Comment 7 2510 2011-07-05 11:45:11 UTC
Created attachment 27255 [details]
patch for IPv6 only systems (replacing APR_INET by APR_UNSPEC, refer comment #6)

(In reply to comment #6)
> Thanks for the patch.
> 
> I am not sure why that code needs to use a specific address family.  Can you
> check it also works if you change the APR_INET to APR_UNSPEC, instead of your
> patch to fall back on _INET6?

Thanks. It works fine with only changing APR_INET to APR_UNSPEC.
I agree with you, there are no need to specify any address families, I think.

Attached the tested patch.
Comment 8 Stefan Fritsch 2011-07-13 19:21:35 UTC
Commited to trunk in r1146256
Comment 9 Christophe JAILLET 2018-03-12 22:33:23 UTC
This is part of apache 2.3.14.

Closing because 2.2 is EOL since 2017-07-11