-
-
Notifications
You must be signed in to change notification settings - Fork 2k
5 second delay upon resolving the local hostname with "socket.getfqdn()" #1900
Description
I'm using a fabric2 module to set-up connections and execute command on the remote host. I noticed that every time I create a connection I get a 10 second delay. Profiling the code I pin-pointed the delay to the "socket.getfqdn()" call in the "paramiko/config.py"
It took 5 second to execute on my M1 mac. Digging deeper I found that the reason is the hostname culprit:
$ scutil --get LocalHostName
my-mac
$ hostname
my-mac.localAfter running this command, the hostnames are set the same, without the ".local" extension, and the problem is solved:
scutil --set HostName $(scutil --get LocalHostName)I understand, that the fundamental issue is in the socket.getfqdn() function, not Paramiko, but maybe it is worth to at least to design some workaround, to avoid such a long delay. I am quite new to the python and this is my first time ever submitting the issue, so please feel free to point out any problems with the issue description. I just want to be helpful!