Having issues opening up a port for my instance on GCE

meisel asked:

I’m running a GCE instance. I ran sudo ufw allow http && nc -l 80 and it succeeds, showing that 80 is open. However, when I try to open up a server by running waitress, a Python server, with sudo waitress-serve --listen=0.0.0.0:80 --call 'flaskr:create_app', it doesn’t work. I made sure that the firewalls set up in GCP allow TCP connections at port 80. When I use localhost instead of 0.0.0.0 it’s fine, but if I use 0.0.0.0, it shows the following stack trace:

File "/usr/lib/python3/dist-packages/waitress/__init__.py", line 11, in serve
server = _server(app, **kw)
File "/usr/lib/python3/dist-packages/waitress/server.py", line 85, in create_server
sockinfo=sockinfo)
File "/usr/lib/python3/dist-packages/waitress/server.py", line 183, in __init__
self.effective_host, self.effective_port = self.getsockname()
File "/usr/lib/python3/dist-packages/waitress/server.py", line 299, in getsockname
self.socketmod.NI_NUMERICSERV)
socket.gaierror: [Errno -3] Temporary failure in name resolution

This indicates that there is a DNS issue going on, but I’m unclear what it is. 0.0.0.0 indicates that it will try to connect for any IP address that it can. Any ideas what might be the issue?

My answer:


This is a bug which was fixed in Waitress 1.0.2. You should upgrade to the latest available version, or file a bug report on Launchpad to request that Ubuntu backport the bug fix.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.