Bug #80689 ndb_config fails with empty string as hostname
Submitted: 10 Mar 2016 14:20 Modified: 13 Jun 2016 17:45
Reporter: Mikael Ronström Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:7.5.2 OS:Any
Assigned to: CPU Architecture:Any

[10 Mar 2016 14:20] Mikael Ronström
Description:
Running the test ndb_config on Mac OS X can in some circumstances fail where Mac OS X hangs
in the call to gethostbyname where name is the empty string.

How to repeat:
Run test case ndb_config on Mac OS X (only repeatable in special occasions, but
has happened to me now 2 times and the fix was produced the 2nd of those times).

Suggested fix:
Avoid calls to gethostbyname with NULL pointer and with empty string.
[10 Mar 2016 16:31] Mauritz Sundell
Posted by developer:
 
Patch looks ok.
I have a few minor comment inlined that can be ignored.

Two notes that one can think of on a rainy day:

HostMatch::eval is not super well defined for hosts with several ip-addresses.
gethostbyname returns a list of all ip-addresses both ipv4 and ipv6 and function only looks at first match for both names.
And the order of addresses could be different in the two calls.
So it could fail recognize a match.

One could also consider using our portlib function Ndb_getInAddr() instead of gethostbyname, it only looks for ipv4 addresses, even if that too only looks at first match.
[13 Jun 2016 17:45] Jon Stephens
Documented fix in the NDB 7.5.2 changelog as follows:

    On MacOS X, ndb_config failed when an empty string was used for the
    --host option.

Closed.