getaddrinfo() hangs when resolving local IP address

Originator:eofster
Number:rdar://28611031 Date Originated:04-Oct-2016 07:01 PM
Status:Duplicate of 28715866 (Closed) Resolved:
Product:macOS SDK Product Version:10.12
Classification:Hang Reproducible:Always
 
Summary:
When getaddrinfo() function is called with the local host name, for example, Johns-MacBook-Pro.local, it hangs for about 5 seconds. It only happens when File Sharing is disabled in the system sharing preferences.

Steps to Reproduce:
1. Make sure file sharing is disabled in system preferences.
2. Manually determine the host name of the local computer and set it, if necessary, to something ending with ‘.local’ like Johns-MacBook-Pro.local.
3. Either run the command: dscacheutil -q host -a name Johns-MacBook-Pro.local
or run the command-line utility from the attached Xcode project.
4. You should see a hang of approximately 5 seconds.
5. Enable file sharing in system preferences.
6. Run the same resolution command again.
7. There should be no delay.

Expected Results:
It was expected to see no delay in local name resolution regardless of file sharing enabled state.

Actual Results:
There was a delay when calling getaddrinfo() with local host name ending in ‘.local’ when file sharing was disabled.

Version:
Version 8.0 (8A218a)

Notes:
If necessary, flush the DNS cache before attempting to reproduce the problem.

Configuration:
Appears on macOS 10.12 including beta 3. Does not appear on previous macOS versions.

Attachments:
'Getaddrinfo.zip' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!