Firefox 3.0 freezes waiting to resolve in DNS

My current daytime setup is for various reasons a Windows XP installation with Ubuntu Jaunty running inside VirtualBox. I use Microsoft Windows for Outlook, SQL Navigator and some web browsing while using the Linux installation for development. This morning I started Firefox in Windows XP, changed focus to VirtualBox or some other window, and when I returned to Firefox it was frozen. I followed the standard Windows trouble-shooting procedure: reboot and get a coffee. When I was logged in again in both Windows and Ubuntu I got the same issue with Firefox in Linux. WTF?

At least I have the tools in Ubuntu to debug this issue. This is a simplified version and approximate order of what I did.

First, create ~/.gdbinit to make GDB a tad more user-friendly:

set pagination off
set radix 16
set print pretty
set history save on

Second, add to /etc/apt/sources.list:

deb // jaunty main restricted universe multiverse
deb // jaunty-updates main restricted universe multiverse
deb // jaunty-security main restricted universe multiverse
deb // jaunty-proposed main restricted universe multiverse

Install some debug symbols:

sudo apt-get install firefox-3.0-dbgsym libnspr4-0d-dbgsym xulrunner-1.9-dbgsym

Debugging time!

$ gdb `which firefox` `pidof firefox`

(gdb) thread apply all bt

Thread 2 (Thread 0xb08eab90 (LWP 4253)):

#9  0xb7e16c7f in getaddrinfo () from /lib/tls/i686/cmov/
#10 0xb7c8d739 in PR_GetAddrInfoByName (hostname=0xbc01ff4 “”, af=0x0, flags=0x8020) at prnetdb.c:2026
#11 0xb7267940 in nsHostResolver::ThreadFunc (arg=0x92d9fd8) at nsHostResolver.cpp:697

Thread 1 (Thread 0xb7d4b6d0 (LWP 4243)):
#0  0xb8003422 in __kernel_vsyscall ()
#1  0xb7fe30e5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/
#2  0xb7c94ed9 in PR_WaitCondVar (cvar=0xcd1ebf8, timeout=0xffffffff) at ptsynch.c:405
#3  0xb7c94f57 in PR_Wait (mon=0xd47d178, timeout=0xffffffff) at ptsynch.c:584
#4  0xb726621b in nsDNSService::Resolve (this=0x92d4b00, hostname=@0xabaf730, flags=<value optimized out>, result=0xbff19ac0) at nsDNSService2.cpp:49

So, we have a thread that is resolving “” and another thread waiting for this hostname to be resolved. Could this be an issue?

Back at the command line, is there an issue with this domain name? Checking on my local computer:

$ host
;; connection timed out; no servers could be reached

Trouble at Google? I must confirm that, so I login to one of my servers and run the same command:

$ host
;; Truncated, retrying in TCP mode. is an alias for has address

Works fine, but what does Truncated, retrying in TCP mode mean? I will investigate that later.

Apparently the company firewall is unable to resolve this domain name, at least for the time being. Google Safe Browsing is built into Firefox 3, so how do I disable it? I looked in about:config and yes, there was a setting called browser.safebrowsing.enabled set to true. I set it to false and… Firefox still froze. Looking at about:config again, I found browser.safebrowsing.malware.enabled and set that one to false as well. Now I am able to write this blog post!

Disabling these configuration options is only curing the symptoms, not the disease. But can I cure an enterprise DNS server that fails to handle truncated responses? I doubt it.

New Windows PC and monitor ordered

I usually pride myself with not falling for "special offers" but when I found this €450 computer and monitor package I could not resist.  The new hardware is an HP Compaq dx2450 Microtower PC and an HP L2208w 22-inch Widescreen LCD Monitor. It’s not high-end stuff, but I think it should work nicely for iTunes, Civilization Ⅳ and some adventure games. Maybe I should start managing my photos in Aperture and do some video editing in Premiere Elements too!

The big question is: should I run Windows XP or Windows Vista?  Or dual-boot with both? Maybe triple-boot with Ubuntu?

Update From the list of software above it might sound like I should be running a Mac instead, but the games and hardware price tag do not fit the equation… 🙁

Update 2 Well, Aperture is only for Macs, right? Maybe I should get Lightroom?

The case of the failing ant copy filterset

I wanted to set a couple of Windows environment variables from Ant. The environment key-value pairs are stored on the HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment key in the registry. As a starting point I used the registry editor to export all keys. I called the file environment.reg.template and modified it to look something like this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]

My ant script contains something like this:

<copy file="environment.reg.template" tofile="environment.reg"
    <filter token="FOO" value="${foo}"/>
    <filter token="BAR" value="${bar}"/>
<exec executable="regedit.exe">
  <arg value="/s"/><!-- "silent" -->
  <arg value="environment.reg"/>

I ran the ant script and looked in environment.reg. It still looked just like environment.reg.template! Running again obviously didn’t work, but I had to try! 🙂 When did a cut & paste of the above and sent to a colleague he could not reproduce the issue. I thought hard about it and then it dawned on me: the registry editor exported a file in Unicode format. I used notepad to convert it to ANSI and then everything worked fine. Case closed.

Using F-Secure Health Check to save hard disk space

After my struggle to install Flash I finally managed to run F-Secure Health Check on the only computer running Windows in the house, my gaming computer with with 512 megabytes of RAM and only 40 gigabytes hard disk drive. It is almost ancient by today’s standards and I had old versions of numerous softwares. At first I thought of the suggested path, upgrading everything, but I quickly realized that I could just as well remove out-of-date programs that I didn’t even remember why I had installed them or when I last used them. Otherwise they might get out of date again before I needed them…

Installing Adobe Flash Player on Windows XP: Problems and solution

Yesterday I wanted to run the excellent F-Secure Health Check web application on my gaming computer. The health check only runs in Internet Explorer, but I don’t use IE if I can avoid it and apparently I had no Flash Player working with Internet Explorer 7. When I tried to install the Flash Player from Adobe’s web site, it failed no matter how much I fiddled with the IE security settings. I found a stand-alone Flash installer on Adobe’s web site and when I ran that installer it failed at “Registering flash9e.ocx”. Registering means OLE/COM/ActiveX stuff, wonderful!

The flash9e.ocx file was nowhere to be found after I closed the installer, but when I ran it again and the error message above was shown the file was available in the directory c:windowssystem32macromed. I ran regsvr32 c:windowssystem32macromedflash9e.ocx and got error code 80070005, meaning “access denied”. Access to what? The registry maybe?

I downloaded and started RegMon with the string regsvr32 and errors only as log filters, ran the installer again and discovered a couple of registry entries that caused access denied errors. The first one was HKEY_CLASSES_ROOTFlashFactory.FlashFactory and that led me to a helpful message in a thread called cannot install flash ActiveX in the Flash Player forums. A number of registry keys for Flash were obviously owned by a different user account and with the instructions from the message I could start the tedious job of removing the registry keys. After going through all clicks for removing a few keys I tried to think of a simpler way.

My gaming computer has two user accounts apart from the Administrator, one for myself and one for my wife. All of these accounts are members of the Administrators group. I was logged in as my own user so I tried to run the registry editor with the Administrator user account instead, but got access denied too. I had probably installed Flash for my wife at some point, so maybe she owned the registry keys? When I started the registry editor as her user, I could remove the registry keys fine! Wonderful! I had to do another sweep with RegMon before I found all the keys I needed to remove.

I ran the installer as the Administator user so that the registry keys will be owned by that user account and now it installed fine. I ran Internet Explorer as the Administrator user too, but the F-Secure Health Check web site still said it couldn’t find the Flash Player. A after some fiddling with the web installation of the Flash Player I got the health check running! I was too tired to check if Flash worked properly for me and my wife in IE and Firefox after all of this so that might be an exercise for another day.

If I would install or upgrade Flash Player on a multiuser Windows XP machine again, I’ll do it as the Administrator user.

If I had too much time on my hands I would make a program that changed owner of all the relevant registry keys to the Administrators group. Others would have use for it.