kquick / Thespian

Python Actor concurrency library
MIT License
189 stars 24 forks source link

Warnings with macOS Sierra related to address info #11

Closed msicilia closed 6 years ago

msicilia commented 6 years ago

I am executing the following simple program in macOS Sierra 10.12.6 and Python 3.6.0:

from thespian.actors import Actor, ActorSystem
class Server(Actor):
    def receiveMessage(self, message, sender):
        print(message)
network = ActorSystem('multiprocTCPBase')
s1 = network.createActor(Server)
network.tell(s1, "msg1")
network.tell(s1, "msg2")
network.shutdown()

Then I get the following warnings:

$ python client_server_basic.py
WARNING:root:Unable to get address info for address msicilia.local (AddressFamily.AF_INET, SocketKind.SOCK_DGRAM, 17, 0): <class 'socket.gaierror'> [Errno 8] nodename nor servname provided, or not known
WARNING:root:Unable to get address info for address msicilia.local (AddressFamily.AF_INET, SocketKind.SOCK_DGRAM, 17, 0): <class 'socket.gaierror'> [Errno 8] nodename nor servname provided, or not known
WARNING:root:Unable to get address info for address msicilia.local (AddressFamily.AF_INET, SocketKind.SOCK_DGRAM, 17, AddressInfo.AI_PASSIVE): <class 'socket.gaierror'> [Errno 8] nodename nor servname provided, or not known
WARNING:root:Unable to get address info for address msicilia.local (AddressFamily.AF_INET, SocketKind.SOCK_DGRAM, 17, AddressInfo.AI_PASSIVE): <class 'socket.gaierror'> [Errno 8] nodename nor servname provided, or not known
INFO:Thespian.Admin:ActorSystem Administrator startup @ ActorAddr-(T|:1900)
msg1
msg2
ActorExitRequest

But it appears to work well. Not sure if I am doing something wrong, but it seems there is some problem that might be specific to Mac OS-provided information. Maybe this is a warning that can be ignored, but just for the case I am reporting it here.

Many thanks in advance, Miguel-Angel

kquick commented 6 years ago

Hi @msicilia,

I think your problem is similar to this one: https://github.com/godaddy/Thespian/issues/16

If it is a similar problem, I think the warnings can be ignored safely, although I can enhance the warning message to provide more detail and explanation. If your configuration doesn't match the one in that issue, let me know what you get instead from the diagnostics there and we can see what might be occurring.

Thanks for reporting this in either case!

Regards, Kevin

msicilia commented 6 years ago

Hi, Many thanks for the quick reaction. Here goes the output of the diagnostics:

>>> import socket
>>> hn = socket.gethostname()
>>> print(str(hn))
msicilia.local
>>> fqdn = socket.getfqdn()
>>> print(str(fqdn))
msicilia.local
>>> socket.getaddrinfo(None, 0, socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
[(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('127.0.0.1', 0))]
>>> socket.getaddrinfo(hn, 0, socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/msicilia/anaconda3/lib/python3.6/socket.py", line 743, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
>>> socket.getaddrinfo(fqdn, 0, socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/msicilia/anaconda3/lib/python3.6/socket.py", line 743, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
>>> exit()
msicilia:~ msicilia$ grep localhost /etc/hosts
# localhost is used to configure the loopback interface
127.0.0.1 localhost
::1 localhost

Looks similar to the other problem reported, but not exactly, it seems two of the sentences fail, as in my case they seem to refer to the same name. As I said, this seems not to be causing problems with the execution of the program, so it appears to be only an annoying message. So it is not critical, many thanks in any case for the quick response!

Regards, Miguel-Angel

kquick commented 6 years ago

Hi @msicilia,

Yes, it looks like your network configuration is underspecified. It shouldn't be a problem for local Thespian use, but you may need to consider updating your network config with a valid FQDN at a later point for external connectivity (Thespian or otherwise). For your local use, it is definitely fine to ignore these warnings, but thanks again for reporting this.

Regards, Kevin

kquick commented 6 years ago

Closing this as resolved, but please feel free to re-open this if you feel there is more that can be done to improve this.