[Twisted-web] web2: reverse dns lookup in twisted reactor thread
James Y Knight
foom at fuhm.net
Tue Jul 11 17:01:07 CDT 2006
On Jul 11, 2006, at 3:41 PM, Div Shekhar wrote:
> Hi,
>
> I've been using web2 for WSGI apps for a few months, and it's been
> working fine. However, I did run into one bug this week:
>
> web2 does a reverse dns lookup of the client ip address, and in the
> twisted reactor thread, no less! When the dns server is unreachable,
> this delays that http request and blocks twisted as well.
>
> I'm planning to solve this by commenting out line 490 in
> twisted/web2/channel/http.py:
>
> host.host = _cachedGetHostByAddr(host.host)
>
> I'd recommend that this lookup be moved to wsgi thread and/or be
> turned off by default. Just wanted to check - am I missing something?
You're missing that it's looking up the _server_ hostname based on
the _server_ ip address. Therefore, it can only blocks on the dns
server once per server IP address.
James
More information about the Twisted-web
mailing list