New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 8 users

Issue metadata

Status: Fixed
OOO (parental leave)
Closed: Aug 2015
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug-Regression

Sign in to add a comment

"localhost." doesn't resolve

Project Member Reported by, Jun 4 2015

Issue description

See attached net-internals log from comment #15 in  issue 455825 .

User reports that with the following /etc/hosts, http://foo.localhost:8080 fails to load because of a failure to resolve "localhost.":

/etc/hosts: localhost foo.loc foo.localhost
559 KB Download
rsleevi, do you have ideas why "localhost." might fail to resolve? User mentioned that putting an additional " localhost." line in /etc/hosts is a workaround.
Event ID 1232 shows that it ended up returning ERR_NAME_NOT_RESOLVED after, unfortunately, going out the network (how'd that happen? I don't know! :P)

The attempted resolution for "foo.localhost" was rewritten to "localhost." (Event ID 1231 shows the original associated CONNECT_JOB; this was your change from  Issue 455825 ), but then sent it to the network.

Per RFC 6761 6.3, a couple things
- Per p3, our DNS resolver SHOULD have recognized localhost as special and used loopback and SHOULD NOT have sent to the network (SHOULD != MUST)
- Per p4, the upstream resolver SHOULD have returned the loopback address and ate it then
- Per p5, the authoritative DNS servers SHOULD have handled them

I can only speculate that 4/5 didn't happen for this user, and our lack of 3 caused the issue.

Adding "localhost." to the /etc/hosts lists would work because our Hosts file parser (//net/dns/dns_hosts) isn't smart enough to know about trailing "." squelching suffix searches, because it's just a base::hash_map on DnsHostsKey (see )

Suggestions (all of them, but any individually would resolve this)
1) DnsTransaction should implement p3 ("Name resolution APIs and libraries") logic for the RFC 6761 hosts
2) Either hash<net::DnsHostKey> ( ) or ParseHostsWithCommaMode ( ) should canonicalize the host entries and appropriately recognize . domains as matching (and probably implicit in the hosts file)

For #2, I'm not sure whether, given a hosts file, if "foo" is an entry for "foo." or "foo" + all the DNS suffix searches (including, implicitly, "."). Probably more research is needed into that format to determine the entire scope of the problem.

For the user, ironically pointed their DNS at a 'well-known good DNS server' (Google's is, although plenty of others, such as OpenDNS, exist) would likely have also squelched this error, since even though we didn't do p3, p4/p5 of 6761 would have kicked in.

Comment 3 by, Jun 10 2015

Re: "a 'well-known good DNS server' (Google's is, although plenty of others, such as OpenDNS, exist) would likely have also squelched this error"

I'm experiencing the same behavior as the OP, using DNS servers and [On Chromium Version 43.0.2357.81 Ubuntu 15.04 (64-bit)]

The stated workaround (adding " localhost." to /etc/hosts) works for me.

Comment 4 by, Jun 11 2015

Status: Started
CL in progress implementing suggestion #1 from comment #2:
I am also having the same issue (Linux also; Debian "Wheezy").  I've uploaded my log file just in case.

2.1 MB Download
Project Member

Comment 6 by, Jun 20 2015

The following revision refers to this bug:

commit d1bc206e4635403d342e40d6e04845c029f1ada7
Author: estark <>
Date: Sat Jun 20 00:44:39 2015

Resolve RFC 6761 localhost names to loopback

Per section 6.3, HostResolverImpl should recognize localhost names as
special and resolve as loopback without sending the query over the

This CL also modifies IsLocalhost() to allow trailing dots ( bug 460331 ),
so that IsLocalhost() can be used to detect localhost names that should
resolve to loopback.

BUG= 496479 , 460331 

Review URL:

Cr-Commit-Position: refs/heads/master@{#335402}


Emily: Did you fix this? If so, mind updating the milestone and status?

Comment 8 by, Aug 14 2015

Labels: M-45
Status: Fixed

Sign in to add a comment