Comment 304 for bug 113201

Revision history for this message
In , Bugz-e (bugz-e) wrote :

We had users complain about UI hang when they typed in a non-existant domain. We had 30 IsInNet statements in the PAC file they were using. Firing up Wireshark showed 2 types of lookup were attempted - normal DNS lookup, and a netbios lookup. Regular DNS lookups returned pretty instantly with NXDOMAIN.

I saw the netbios lookup packets conformed to NameSrvQueryCount and NameSrvQueryTimeout defaults as mentioned here http://support.microsoft.com/kb/314053. 1.5seconds * 3 attempts = 4.5 seconds per IsInNet clause.

Completely turning netbios off fixed the issue, but that's clearly a no-go (not a Windows engineer, I'd have happily turned it off!).

Someone in our team came up with the idea of cutting down on the amount of resolving needed.

We went from the following:

=== from ===
if (isInNet(host, "172.31.0.0", "255.255.0.0") ||
    isInNet(host, "10.0.1.0", "255.255.255.0"))
    {
    return "proxy1.domain.co.uk:1234"
    }
    if (isInNet(host, "192.168.0.0", "255.255.0.0") ||
        isInNet(host, "127.0.0.0", "255.0.0.0") ||
        isInNet(host, "172.16.0.0", "255.255.0.0") ||
        isInNet(host, "172.19.4.0", "255.255.252.0") ||
        ....
        ....
        isInNet(host, "172.20.0.0", "255.255.0.0") ||
        isInNet(host, "172.21.0.0", "255.255.0.0") ||
        isInNet(host, "10.0.0.0", "255.0.0.0"))
    {
    return "DIRECT"

=== to ===

var resolved_ip = dnsResolve(host);

if (isInNet(resolved_ip, "172.31.0.0", "255.255.0.0") ||
    isInNet(resolved_ip, "10.0.1.0", "255.255.255.0"))
    {
    return "proxy1.domain.co.uk:1234"
    }
    if (isInNet(resolved_ip, "192.168.0.0", "255.255.0.0") ||
        isInNet(resolved_ip, "127.0.0.0", "255.0.0.0") ||
        isInNet(resolved_ip, "172.16.0.0", "255.255.0.0") ||
        isInNet(resolved_ip, "172.19.4.0", "255.255.252.0") ||
        ....
        ....
        isInNet(resolved_ip, "172.20.0.0", "255.255.0.0") ||
        isInNet(resolved_ip, "172.21.0.0", "255.255.0.0") ||
        isInNet(resolved_ip, "10.0.0.0", "255.0.0.0"))
    {
    return "DIRECT"

======

It's not a fix, but it's 1001 times better than what we had before, hope this helps someone with a similar situation.