https://bz.apache.org/bugzilla/show_bug.cgi?id=69804

            Bug ID: 69804
           Summary: ListenCoresBucketsRatio: IPv6 sockets not duplicated
                    with Listen 80 / Listen *:80
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

With Listen 80 or Listen *:80 and ListenCoresBucketsRatio > 0 on Linux
(SO_REUSEPORT), apache opens multiple IPv4 listener buckets but only a single
IPv6 listener.

Under high IPv6 traffic load this leads to accept-queue overflows and delayed
SYN-ACKs.

Root cause appears to be in ap_duplicate_listeners(): duplicate sockets are
created after re-resolving the address with apr_sockaddr_info_get(...,
APR_UNSPEC, ...), which can select an IPv4 address even when the original
listener was IPv6, so IPv6 is not bucketized.

Config (minimal reproduce):
Listen 80
ListenCoresBucketsRatio 8

Steps to reproduce:
Start httpd with the config above on a dual-stack host.

Inspect listeners:

ss -lntpO 'sport = :80'

Expected:

IPv4 and IPv6 listeners are equally bucketized (one socket per bucket per
family), e.g., multiple 0.0.0.0:80 and multiple [::]:80.

Observed:

Multiple IPv4 sockets (bucketized) but a single IPv6 socket.

Code references:
Initial listener creation (prioritizes v6 when building the list):
server/listen.c lines 602–629
https://github.com/apache/httpd/blob/5cec2b41bdbb776b012eca4aed9ac8b2946beea9/server/listen.c#L602-L629

Bucket duplication path (re-resolves with APR_UNSPEC, losing v6
family/scoping):
server/listen.c lines 885–913
https://github.com/apache/httpd/blob/5cec2b41bdbb776b012eca4aed9ac8b2946beea9/server/listen.c#L885-L913

Impact:

IPv6 traffic is funneled through a single accept queue, causing backlog
pressure and handshake delays, while IPv4 remains healthy.

Workaround:

Bind IPv6 family explicitly ensuring it is bucketized. It will also accept IPv4
connections.

Listen [::]:80

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to