Bug 1270950 - getaddrinfo() takes long time when lots of IP addresses are configured
Summary: getaddrinfo() takes long time when lots of IP addresses are configured
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: glibc
Version: 6.7
Hardware: All
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: DJ Delorie
QA Contact: Sergey Kolosov
Mark Flitter
URL:
Whiteboard:
Depends On:
Blocks: 1361283
TreeView+ depends on / blocked
 
Reported: 2015-10-12 18:05 UTC by Steven Feltner
Modified: 2017-03-21 10:35 UTC (History)
11 users (show)

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.
Clone Of:
Environment:
Last Closed: 2017-03-21 10:35:04 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
CentOS 0009589 None None None Never
Red Hat Product Errata RHSA-2017:0680 normal SHIPPED_LIVE Moderate: glibc security and bug fix update 2017-03-21 12:36:34 UTC

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@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):
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


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