[Bug 966368] [NEW] getaddrinfo sends duplicate query and breaks dns round robin

Karl Pickett kjp at ci.uchicago.edu
Tue Mar 27 16:29:48 UTC 2012


Public bug reported:

This happens on 10.04 lts and 12.04 beta.  Note that fedora 15 does NOT
have this problem, so it appears to be eglibc specific.  ipv6 is not
enabled (only the auto link level addresses are on)

The host 'gridftp.nautilus.nics.xsede.org' has two ipv4 ips.  when using ping,
each ping execution alternates hosts, and strace shows only one dns query is
sent.  

however, another program using getaddrinfo() does not get the same rotation. 
It appears that getaddrinfo inexplicably sends a redundant dns query (only
thing different is transaction id), thus causing an entire rotation through
both hosts each time.  The returned ip will always be fairly constant - it will
be the last ip that 'ping' got.   So, if a host has a power of 2 number of ips,
rotation is broken.. particularly badly if there are only two ips total.

note: nscd is not running, and it does not appear to fix the problem

test program:

int main(void)
{
    struct addrinfo *result;
    struct addrinfo *res;
    int error;

   /* nautilus has two hosts, we want to pick a random
     * one.  
     * Note: problem occurs with or without final trailing '.' */
    error = getaddrinfo("gridftp.nautilus.nics.xsede.org",  NULL, NULL, &result);
    // We just sent two DNS queries, which breaks rotation when a host has two ips and the nameserver rotates them per query

strace of c program:

strace -s 100 -e sendto ./a.out 
sendto(3, "\24\0\0\0\26\0\1\3\276\301pO\0\0\0\0\0\0\0\0", 20, 0,
{sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
sendto(3,
"\360\342\1\0\0\1\0\0\0\0\0\0\7gridftp\10nautilus\4nics\5xsede\3org\0\0\1\0\1",
49, MSG_NOSIGNAL, NULL, 0) = 49
sendto(3,
"\2654\1\0\0\1\0\0\0\0\0\0\7gridftp\10nautilus\4nics\5xsede\3org\0\0\1\0\1",
49, MSG_NOSIGNAL, NULL, 0) = 49

** Affects: eglibc (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to eglibc in Ubuntu.
https://bugs.launchpad.net/bugs/966368

Title:
  getaddrinfo sends duplicate query and breaks dns round robin

Status in “eglibc” package in Ubuntu:
  New

Bug description:
  This happens on 10.04 lts and 12.04 beta.  Note that fedora 15 does
  NOT have this problem, so it appears to be eglibc specific.  ipv6 is
  not enabled (only the auto link level addresses are on)

  The host 'gridftp.nautilus.nics.xsede.org' has two ipv4 ips.  when using ping,
  each ping execution alternates hosts, and strace shows only one dns query is
  sent.  

  however, another program using getaddrinfo() does not get the same rotation. 
  It appears that getaddrinfo inexplicably sends a redundant dns query (only
  thing different is transaction id), thus causing an entire rotation through
  both hosts each time.  The returned ip will always be fairly constant - it will
  be the last ip that 'ping' got.   So, if a host has a power of 2 number of ips,
  rotation is broken.. particularly badly if there are only two ips total.

  note: nscd is not running, and it does not appear to fix the problem

  test program:

  int main(void)
  {
      struct addrinfo *result;
      struct addrinfo *res;
      int error;

     /* nautilus has two hosts, we want to pick a random
       * one.  
       * Note: problem occurs with or without final trailing '.' */
      error = getaddrinfo("gridftp.nautilus.nics.xsede.org",  NULL, NULL, &result);
      // We just sent two DNS queries, which breaks rotation when a host has two ips and the nameserver rotates them per query

  strace of c program:

  strace -s 100 -e sendto ./a.out 
  sendto(3, "\24\0\0\0\26\0\1\3\276\301pO\0\0\0\0\0\0\0\0", 20, 0,
  {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
  sendto(3,
  "\360\342\1\0\0\1\0\0\0\0\0\0\7gridftp\10nautilus\4nics\5xsede\3org\0\0\1\0\1",
  49, MSG_NOSIGNAL, NULL, 0) = 49
  sendto(3,
  "\2654\1\0\0\1\0\0\0\0\0\0\7gridftp\10nautilus\4nics\5xsede\3org\0\0\1\0\1",
  49, MSG_NOSIGNAL, NULL, 0) = 49

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/966368/+subscriptions




More information about the foundations-bugs mailing list