[Catalyst] C::Engine::HTTP taking very long

Andrew Rodland arodland at comcast.net
Mon Apr 20 12:04:45 GMT 2009


On Monday 20 April 2009 06:26:57 am Ian Wells wrote:
> 2009/4/20 Andrew Rodland <arodland at comcast.net>:
> > The time spent in inet_ntoa
> > is your system DNS resolver choking while trying to reverse-lookup the
> > source IP address of the request. Most likely situation: you're using
> > RFC1918 addresses and your network is set up improperly to do DNS for
> > these. If you can't fix this, hosts file entries might alleviate the
> > problem.
>
> I wouldn't necessarily assume that everyone has reverse lookup DNS on
> their test network.  (Mine certainly doesn't, and I've been bitten by
> this slowing things down in the last few days.)  Is there any chance
> we could make this lookup configurable?

You don't need to have reverse DNS, you just need to not have a _broken_ DNS 
setup. Queries for RFC1918 addresses should fail NXDOMAIN instantly (or return 
success, of course). It's only when things are misconfigured that you get a 
slow SERVFAIL, in which case you can patch it up by setting up some (non-
broken) local DNS or fooling with hosts.

Anyway, looking at the source of 5.8001 it looks like reverse-lookup on the 
remote address has already been removed from Catalyst::Engine::HTTP::_sockaddr 
-- the remote hostname is produced lazily only when $c->req->hostname is 
called. Engine::HTTP only calls gethostbyaddr on the local bind address, which 
in all fairness really ought to work -- although perhaps an exception could be 
made to force "localhost" without actually doing (and failing) the lookup in 
the case of INADDR_ANY?

Andrew




More information about the Catalyst mailing list