TCP connection to localhost & DNS issues

A few days ago I started seeing test failures resulting from a new DNS configuration in GH Action runners on ubuntu-latest.

Whether you get the new or old DNS configuration is seemingly random with different jobs in the same workflow run getting different configurations.

Test Workflow

Here’s a test workflow which checks the output of the shell hostname and Python socket network interfaces, then opens a TCP server-client pair and attempts to send some messages between them:

Here’s an example of a working DNS configuration (for local TCP):

hostname -A: fv-az133-918.internal.cloudapp.net fv-az133-918 
hostname -d: ujkaxcq0dguetbxcd10lygaejf.cx.internal.cloudapp.net
hostname -f: fv-az133-918.ujkaxcq0dguetbxcd10lygaejf.cx.internal.cloudapp.net

With this configuration it is possible to open a TCP connection to:

  • 127.0.0.1
  • socket.gethostname() # short hostname
  • socket.getfqdn() # FQDN

Note1: Looking up the host by name yields different results depending on which form of the hostname you provide - initial commit · oliver-sanders/actions-dns-test@b944572 · GitHub

Note2: $(hostname -f) does not appear in $(hostname -A).

And here’s an example of a broken one (for local TCP):

hostname -A: fv-az210-546 fv-az210-546 
hostname -d: 4mfgd40mw1herku3etvgsefafa.xx.internal.cloudapp.net
hostname -f: fv-az210-546.4mfgd40mw1herku3etvgsefafa.xx.internal.cloudapp.net

With this configuration it is possible to open a TCP connection to 127.0.0.1, however, the other two connections fail.

Note1: The *.internal.cloudapp.net domain is missing from this example.

Note2: $(hostname -f) does not appear in $(hostname -A).


I’ve been successfully using GH actions to test an application that resolves hostnames from aliases and performs local TCP connections since May last year. This issue has only cropped up in the last week or so.

Any thoughts or ideas?

That looks like it might be related to this issue:

1 Like