Bug 1125269

Summary: ab fails when domain name resolved to IPv6 adress
Product: Red Hat Enterprise Linux 6 Reporter: Martin Frodl <mfrodl>
Component: httpdAssignee: Luboš Uhliarik <luhliari>
Status: CLOSED ERRATA QA Contact: Filip Holec <fholec>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.5CC: dkutalek, jkaluza, jorton, psplicha
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: httpd-2.2.15-40.el6 Doc Type: Bug Fix
Doc Text:
Prior to this update, the ab utility tried to connect only to the first address of the domain. Consequently, when the first returned address was unreachable but the others were reachable, ab failed. This bug has been fixed, and ab now tries to connect to all addresses returned during domain name resolution.
Story Points: ---
Clone Of:
: 1125276 1209552 (view as bug list) Environment:
Last Closed: 2015-07-22 05:53:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1125276, 1209552    

Description Martin Frodl 2014-07-31 13:14:43 UTC
Description of problem:

When ab is run for a domain name which resolves to an IPv6 address first, it exits with failure even if the domain name can be resolved to an IPv4, too:

--------------------------------------------------------------------------------
$ ab http://www.apache.org/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.apache.org (be patient)...apr_socket_recv: Network is unreachable (101)
--------------------------------------------------------------------------------

This error message is similar to the one printed by wget for the same URL in the first phase. Unlike ab, wget tries to resolve the domain name to IPv4 once IPv6 has failed:

--------------------------------------------------------------------------------
$ wget http://www.apache.org/
--2014-07-31 08:51:58--  http://www.apache.org/
Resolving www.apache.org... 2001:610:1:80bc:192:87:106:229, 192.87.106.229, 140.211.11.131
Connecting to www.apache.org|2001:610:1:80bc:192:87:106:229|:80... failed: Network is unreachable.
Connecting to www.apache.org|192.87.106.229|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 41041 (40K) [text/html]
Saving to: `index.html'

100%[======================================>] 41,041      97.2K/s   in 0.4s

2014-07-31 08:51:59 (97.2 KB/s) - `index.html' saved [41041/41041]
--------------------------------------------------------------------------------

It seems that ab works fine exactly for those domain names which resolve to IPv4 only, i.e. those which are not resolved to IPv6 first:

--------------------------------------------------------------------------------
$ ab http://www.redhat.com/
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.redhat.com (be patient).....done


Server Software:        Apache-Coyote/1.1
Server Hostname:        www.redhat.com
Server Port:            80

Document Path:          /
Document Length:        75730 bytes

Concurrency Level:      1
Time taken for tests:   1.705 seconds
Complete requests:      1
Failed requests:        0
Write errors:           0
Total transferred:      76285 bytes
HTML transferred:       75730 bytes
Requests per second:    0.59 [#/sec] (mean)
Time per request:       1705.085 [ms] (mean)
Time per request:       1705.085 [ms] (mean, across all concurrent requests)
Transfer rate:          43.69 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       47   47   0.0     47      47
Processing:  1658 1658   0.0   1658    1658
Waiting:     1436 1436   0.0   1436    1436
Total:       1705 1705   0.0   1705    1705


$ wget http://www.redhat.com/
--2014-07-31 15:03:44--  http://www.redhat.com/
Resolving www.redhat.com (www.redhat.com)... 2.17.39.214
Connecting to www.redhat.com (www.redhat.com)|2.17.39.214|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

    [ <=>                                                                                                                                                 ] 75,725      --.-K/s   in 0.1s    

2014-07-31 15:03:46 (690 KB/s) - ‘index.html’ saved [75725]
--------------------------------------------------------------------------------

It seems reasonable to me to follow wget's example and don't give up after IPv6 connection fails but rather try the IPv4 instead.

Version-Release number of selected component (if applicable):
httpd-tools-2.2.15-31.el6_5

Comment 5 Jan Kaluža 2014-09-23 07:15:08 UTC
Fix committed upstream: http://svn.apache.org/r1626956

Comment 6 Jan Kaluža 2014-09-30 10:56:56 UTC
Follow up: http://svn.apache.org/r1628388

Comment 12 errata-xmlrpc 2015-07-22 05:53:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-1249.html