Bug 1270950 - getaddrinfo() takes long time when lots of IP addresses are configured
getaddrinfo() takes long time when lots of IP addresses are configured
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: glibc (Show other bugs)
All Unspecified
unspecified Severity high
: rc
: ---
Assigned To: DJ Delorie
Sergey Kolosov
Mark Flitter
: Patch
Depends On:
Blocks: 1361283
  Show dependency treegraph
Reported: 2015-10-12 14:05 EDT by Steven Feltner
Modified: 2017-03-21 06:35 EDT (History)
11 users (show)

See Also:
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:
Last Closed: 2017-03-21 06:35:04 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
CentOS 0009589 None None None Never

  None (edit)
Description Steven Feltner 2015-10-12 14:05:37 EDT
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@gmail.com>
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):

How reproducible:

From the original glibc BZ report:

- configure lots of addresses
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("", "0", &ai, &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 06:35:04 EDT
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.


Note You need to log in before you can comment on or make changes to this bug.