Staf is calling function gethosbyname() also on Windows platforms. However, Microsoft has deprecated this function quite a while ago: see the MSDN article (https://msdn.microsoft.com/en-us/library/windows/desktop/ms738524(v=vs.85).aspx). Quote:
"Note The gethostbyname function has been deprecated by the introduction of the getaddrinfo function. Developers creating Windows Sockets 2 applications are urged to use the getaddrinfo function instead of gethostbyname."
It is completely unclear what it means. But in our experience it seems to mean that gethostbyname() may fail under certain circumstances, especially on the latest Windows OS releases. We have witnessed the problems on Windows 2012r2 and Windows 8.1.
It is occurring more and more often in one of our testing environments as we are bringing in new Windows OS versions. See example staf command run on host "testdriver.lab.mycompany.com" (server names are replaced):
staf testhost.lab.mycompany.com SEM REQUEST MUTEX PYTAFLock
Error submitting request, RC: 16
Additional info
---------------
An error occurred when the SEM service on machine 'testhost.lab.mycompany.com'
attempted to register for garbage collection notification on endpoint
'tcp://testdriver.lab.mycompany.com@6500'. Reason: STAFConnectionProviderConnect:
Error resolving host name: Unknown host name: testdriver.lab.mycompany.com,
gethostbyname(): 22, Endpoint: tcp://testdriver.lab.mycompany.com@6500
The DNS is correctly configured and resolving of the host "testdriver.lab.mycompany.com" on host "testhost.lab.mycompany.com" works just fine as long as gethostbyname() is not used. getaddrinfo() works just fine at times when gethostbyname() fails. getahostbyname() actually succeeds at the same time if it is run in a different user account! So when it starts failing the only workaround we found is to start using a different account. It also seems to start working again if the user for which it starts failing logs into the windows machine using RDP connection. It starts failing when he logs out.
So in order to support also latest Windows OS releases gethostbyname() must be replaced with getaddrinfo() everywhere in staf.