HI,
I just saw this error in my server log, just once, with the following entry:
ERROR:web2py:Traceback (most recent call last):
File "/home/www-data/web2py/gluon/main.py", line 401, in wsgibase
socket.gethostbyname(http_host)]
gaierror: [Errno -2] Name or service not known
So far it is just that one occurrence (and not from a web request generated
by me).
And so far all web requests from my end work ok.
Should I act on it somehow?.
I'm using latest web2py trunk, with ubuntu 10.04, postgresql, nginx,
uwsgi-python.
Thanks,
Carlos
On Wednesday, May 16, 2012 3:58:22 PM UTC-5, Chris wrote:
>
>
> I wrote a patch to fix the problem on my server, which is basically just
> commenting out that line (main.py:390ish):
>
> local_hosts =
> [http_host,'::1','127.0.0.1','::ffff:127.0.0.1']
> if not global_settings.web2py_runtime_gae:
> local_hosts += [socket.gethostname()]
> # socket.gethostbyname(http_host)]
>
> It looks like that line is just to check for the request is coming from
> the externally facing IP. Could that perhaps be wrapped in a try-catch
> block and the results cached?
>
> Thanks,
> Chris
>
>
> On Tuesday, December 6, 2011 10:01:33 AM UTC-5, Richard wrote:
>>
>> I don't know if you have any constrain, but for testing purpose you can
>> use nginx setup script in web2py/scripts folder... There is one for ubuntu
>> at least...
>>
>> RicharD
>>
>> On Mon, Dec 5, 2011 at 5:48 PM, Chris <> wrote:
>>
>>> I'm using web2py with nginx, and I've experienced the following error
>>> on redeploying my app:
>>>
>>> socket.gethostbynamesocket.gethostbyname(http_host) File "/var/
>>> web2py/cow/gluon/main.py", line 396, in wsgibase
>>> socket.gethostbyname(http_host)]
>>> gaierror: [Errno -2] Name or service not known
>>>
>>>
>>> I traced this down to a particular section in gluon/main.py:
>>>
>>> local_hosts = [http_host,'::1','127.0.0.1','::ffff:
>>> 127.0.0.1']
>>> if not global_settings.web2py_runtime_gae:
>>> local_hosts += [socket.gethostname(),
>>> socket.gethostbyname(http_host)]
>>>
>>> As it turns out, http_host (the value above) is mapped to the
>>> nginx.conf value for http_host:
>>>
>>> upstream custom_server_name {
>>> server 127.0.0.1:8000;
>>> }
>>>
>>>
>>> It seems like what's happening is that web2py is receiving the http;//
>>> custom_server_name instead of http://localhost, and
>>> socket.gethostbyname() chokes on that. Is there something I should be
>>> changing in the configuration to prevent this from happening?
>>>
>>
>>
> On Tuesday, December 6, 2011 10:01:33 AM UTC-5, Richard wrote:
>>
>> I don't know if you have any constrain, but for testing purpose you can
>> use nginx setup script in web2py/scripts folder... There is one for ubuntu
>> at least...
>>
>> RicharD
>>
>> On Mon, Dec 5, 2011 at 5:48 PM, Chris <> wrote:
>>
>>> I'm using web2py with nginx, and I've experienced the following error
>>> on redeploying my app:
>>>
>>> socket.gethostbynamesocket.gethostbyname(http_host) File "/var/
>>> web2py/cow/gluon/main.py", line 396, in wsgibase
>>> socket.gethostbyname(http_host)]
>>> gaierror: [Errno -2] Name or service not known
>>>
>>>
>>> I traced this down to a particular section in gluon/main.py:
>>>
>>> local_hosts = [http_host,'::1','127.0.0.1','::ffff:
>>> 127.0.0.1']
>>> if not global_settings.web2py_runtime_gae:
>>> local_hosts += [socket.gethostname(),
>>> socket.gethostbyname(http_host)]
>>>
>>> As it turns out, http_host (the value above) is mapped to the
>>> nginx.conf value for http_host:
>>>
>>> upstream custom_server_name {
>>> server 127.0.0.1:8000;
>>> }
>>>
>>>
>>> It seems like what's happening is that web2py is receiving the http;//
>>> custom_server_name instead of http://localhost, and
>>> socket.gethostbyname() chokes on that. Is there something I should be
>>> changing in the configuration to prevent this from happening?
>>>
>>
>>
> On Tuesday, December 6, 2011 10:01:33 AM UTC-5, Richard wrote:
>>
>> I don't know if you have any constrain, but for testing purpose you can
>> use nginx setup script in web2py/scripts folder... There is one for ubuntu
>> at least...
>>
>> RicharD
>>
>> On Mon, Dec 5, 2011 at 5:48 PM, Chris <> wrote:
>>
>>> I'm using web2py with nginx, and I've experienced the following error
>>> on redeploying my app:
>>>
>>> socket.gethostbynamesocket.gethostbyname(http_host) File "/var/
>>> web2py/cow/gluon/main.py", line 396, in wsgibase
>>> socket.gethostbyname(http_host)]
>>> gaierror: [Errno -2] Name or service not known
>>>
>>>
>>> I traced this down to a particular section in gluon/main.py:
>>>
>>> local_hosts = [http_host,'::1','127.0.0.1','::ffff:
>>> 127.0.0.1']
>>> if not global_settings.web2py_runtime_gae:
>>> local_hosts += [socket.gethostname(),
>>> socket.gethostbyname(http_host)]
>>>
>>> As it turns out, http_host (the value above) is mapped to the
>>> nginx.conf value for http_host:
>>>
>>> upstream custom_server_name {
>>> server 127.0.0.1:8000;
>>> }
>>>
>>>
>>> It seems like what's happening is that web2py is receiving the http;//
>>> custom_server_name instead of http://localhost, and
>>> socket.gethostbyname() chokes on that. Is there something I should be
>>> changing in the configuration to prevent this from happening?
>>>
>>
>>