Percona XtraDB Cluster - HA scalable solution for MySQL

getaddrinfo failure

Reported by Raghavendra D Prabhu on 2013-11-13
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL patches by Codership
Status tracked in 5.6
Alex Yurchenko
Percona XtraDB Cluster
Status tracked in Trunk
Raghavendra D Prabhu

Bug Description

wsrep_check_ip (added in wsrep-24 and wsrep-56) fails on Debian as:

2013-11-13 16:04:07 7627 [ERROR] WSREP: getaddrinfo() failed on '*': -2 (Name or service not known)
2013-11-13 16:04:07 7627 [ERROR] WSREP: Networking not configured, cannot receive state transfer.

This is because the default value of bind_address (if not set) is '*'

mysql> show global variables like '%bind_address%';
| Variable_name | Value |
| bind_address | * |
1 row in set (0.01 sec)


Note this won't occur if wsrep-node-address is provided.

Also, this didn't occur with wsrep-23 branch.

description: updated

This is how the code looks in activate_tcp_port:

  if (strcasecmp(my_bind_addr_str, MY_BIND_ALL_ADDRESSES) == 0)
      That's the case when bind-address is set to a special value ('*'),
      meaning "bind to all available IP addresses". If the box supports
      the IPv6 stack, that means binding to '::'. If only IPv4 is available,
      bind to ''.

    bool ipv6_available= false;

    if (!getaddrinfo(ipv6_all_addresses, port_buf, &hints, &ai))
        IPv6 might be available (the system might be able to resolve an IPv6
        address, but not be able to create an IPv6-socket). Try to create a
        dummy IPv6-socket. Do not instrument that socket by P_S.

      MYSQL_SOCKET s= mysql_socket_socket(0, AF_INET6, SOCK_STREAM, 0);

      ipv6_available= mysql_socket_getfd(s) != INVALID_SOCKET;


    if (ipv6_available)
      sql_print_information("IPv6 is available.");

      // Address info (ai) for IPv6 address is already set.

      bind_address_str= ipv6_all_addresses;
      sql_print_information("IPv6 is not available.");

      // Retrieve address info (ai) for IPv4 address.

      if (getaddrinfo(ipv4_all_addresses, port_buf, &hints, &ai))
        sql_print_error("Can't start server: cannot resolve hostname!");

      bind_address_str= ipv4_all_addresses;
    if (getaddrinfo(my_bind_addr_str, port_buf, &hints, &ai))
      sql_perror(ER_DEFAULT(ER_IPSOCK_ERROR)); /* purecov: tested */
      sql_print_error("Can't start server: cannot resolve hostname!");
      unireg_abort(1); /* purecov: tested */

    bind_address_str= my_bind_addr_str;


It should be handled similarly in wsrep_check_ip.

  MY_BIND_ALL_ADDRESSES defines a special value for the bind-address option,
  which means that the server should listen to all available network addresses,
  both IPv6 (if available) and IPv4.

  Basically, this value instructs the server to make an attempt to bind the
  server socket to '::' address, and rollback to '' if the attempt fails.
const char *MY_BIND_ALL_ADDRESSES= "*";


I cleaned up this part but wsrep-node-address is still required which brings up the question, why is not allowed for wsrep?

from galera:


            if (host == "" || host == "0:0:0:0:0:0:0:0" || host == "::")
                gu_throw_error(EINVAL) << "Bad value for 'node_address': '"
                                       << host << '\'';


If this is allowed then all the wsrep-node-address noise can be avoided (and all the ifconfig called from mysqld!). mysqld can listen on fine, why not wsrep/galera?

Alex Yurchenko (ayurchen) wrote :

As discussed in chat, wsrep-node-address variable is not to bind listening socket. It is to tell other nodes how they can reach this node (specifically to perform state transfer), and/or to show in wsrep_incoming_addresses status variable.

In other words, it is an address by which node should be addressed. So it can't be trivial.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers