Bug 1270950

Summary: getaddrinfo() takes long time when lots of IP addresses are configured
Product: Red Hat Enterprise Linux 6 Reporter: Steven Feltner <steven.feltner>
Component: glibcAssignee: DJ Delorie <dj>
Status: CLOSED ERRATA QA Contact: Sergey Kolosov <skolosov>
Severity: high Docs Contact: Mark Flitter <mflitter>
Priority: unspecified    
Version: 6.7CC: ashankar, codonell, dj, fweimer, gbailey, gjasny, mcermak, mflitter, mnewsome, pfrankli, skolosov
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Improved behavior in getaddrinfo() when scanning interfaces after being passed an IP address Versions of glibc prior to this one would scan every IP address on an interface referenced by a getaddrinfo() call, even if the hostname passed was itself a numeric IP address. On systems with large numbers of IP addresses configured on the interface, this caused the call to take an excessive amount of time. With this update, the scan happens only when needed and the call returns quickly when passed a numeric IP address.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 10:35:04 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: 1361283    

Description Steven Feltner 2015-10-12 18:05:37 UTC
Description of problem:
This is a bug that reported into glibc in 2011. It has been fixed in glibc, but this commit ha not made it into the CentOS release of glibc as of glibc-2.12-1.166.el6_7.3.x86_64.

Here is a link to the original BZ for glibc: https://sourceware.org/bugzilla/show_bug.cgi?id=12907 [^]

We are now configuring over 10k IPs on the same server, and this has been killing us. As a temporary fix, I patched glibc-2.12-1.166.el6_7.3.x86_64 with Ulrich's patch and have been running it in our production environment.

Here is the specific glibc commit info:
commit fa3fc0fe5f452d0aa7e435d8f32e992958683819
Author: Ulrich Drepper <drepper>
Date: Wed Jun 22 15:00:54 2011 -0400

    Avoid __check_pf calls in getaddrinfo unless really needed

Can we please get this added into the next release of glibc?

Version-Release number of selected component (if applicable):
glibc-2.12-1.166.el6_7.3.x86_64

How reproducible:

From the original glibc BZ report:

- configure lots of addresses
#!/usr/bin/perl
my $addrCount = 64000;
for (my $i=1; $i < $addrCount; $i++) {
  my $w1 = ($i % 254) + 1;
  my $w2 = ($i / 254) + 1;
  my $s = sprintf("ip addr add 10.5.%d.%d dev eth0", $w2, $w1);
  print "$s\n";
  system ($s)
} 
- resolve a literal address
  struct addrinfo ai;
  struct addrinfo *ailist = NULL;
  memset(&ai, 0, sizeof(ai));
  ai.ai_family = af;
  ai.ai_flags = AI_PASSIVE;
  getaddrinfo("10.5.1.1", "0", &ai, &ailist);
  freeaddrinfo(ailist);

Actual results:
Takes a very long time to spin through the inventory of IP addresses.

Expected results:


Additional info:

Comment 8 errata-xmlrpc 2017-03-21 10:35:04 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-2017-0680.html