Ask HN: Since yesterday, Firefox and Thunderbird take 30s to start. Why?

4 points by JonathanBeuys ↗ HN
Both FF and Thunderbird suddenly take 30s to start on my linux machine.

"firefox -safe-mode" does no speed it up.

When I run "strace firefox", the first time it hangs after this line:

restart_syscall(<... resuming interrupted poll ...>

Then it hangs multiple times after lines after lines that all contain the word "poll" in one form or another.

What does the combined Linux expertise of HN say? How do I debug this situation?

12 comments

[ 2.4 ms ] story [ 48.6 ms ] thread
There's crash reports in the .mozilla folder but I'm not sure how verbose they are.

You can also try starting from cli and set the logging level

    firefox -MOZ_LOG=all:1
Looking at my versions I'm behind on firefox but thunderbird is up to date. Both start in under a second. Are you using the snap distributions? Also try disabling any extensions first before delving deeper.
After setting the log level, where do I see the log?

I think -safe-mode disables all extensions. No snap, just FF.

Amazingly, it even happens when I install a fresh version of FF in a docker container!

Maybe some update hit that is doing some funky network stuff that is slow via my router or something?

Hmm... FF starts immediately if I disconnect from the network first. That seems to support the last idea.

Seems to be some kind of DNS issue. When I replace my /etc/resolv.conf file with a file that contains only this:

    nameserver 8.8.8.8
    options edns0 trust-ad
The delay goes away.

Before there was also:

    nameserver 127.0.0.53
    options edns0 trust-ad
    search <hostnameofmyrouter>
No idea what 127.0.0.53 is. Is there a DNS server running on my laptop? And also not sure what "search" does.
127.0.0.53 is the proxy dns server run by systemd.

Search specifies one or more domains, for instance ‘domain1.com’, and then if a program tries to resolve ‘host1’ if that doesn’t work it’ll also try ‘host1.domain1.com’.

That way you can give your router for instance the host name router.domain1.com and it’ll work if you type ‘ping router’.

The proxy is in place to cache dns queries?

And which dns server does the proxy dns server connect to?

No. I’m no systemd expert but as far as I know the idea is that the resolv.conf configuration system was designed decades ago when you’d have a Unix system connected through cable to a network run by an expert. But a modern system might be wirelessly connected to many different networks through time or even at the same time, with many of them not run by consumers who have no idea what they’re doing. So there’s a mismatch.

The earlier solution was dhcp clients editing resolv.conf to include the configuration they get from the dhcp server. But that doesn’t really work if it changes all the time, if you want to have a different manual configuration for some networks or if you are connected to multiple networks at the same time.

Systemd tries to make it possible to configure this in a modern way and the idea is that most applications (that use the system libraries in the typical way) don’t use resolv.conf at all but talk to a part of systemd to resolve queries with that part using modern configuration. Other legacy applications that try to parse that file or use the configuration in another way find a proxy dns server run by systemd that gives them the same answers the other applications get.

Sounds like a timeout with a DNS lookup or a TCP handshake.

Try tcpdump, see what happens around that time?

And what should I look for in the output of tcpdump?
> Ask HN: Since yesterday, Firefox and Thunderbird take 30s to start. Why?

Your computer is too slow.

Update:

It seems Firefox contacts <myhostname>.<hostnameofmyrouter> and that hangs.

Why does FF do that? Can I disable it?

For now, I put this into /etc/hosts:

0.0.0.0 <myhostname>.<hostnameofmyrouter>

Now Firefox and Thunderbird start fast again.

you have a "search" domain configured in resolver so it tries subdomains of that in addition to the bare domain, but that domain is not responding to your queries.
When you say "it tries" - who tries? Firefox? How can I tell it to not do that?
Firefox and other programs that respect your resolver configuration. Remove the unresponsive search domain from your resolver configuration file, or if you control the domain, troubleshoot its DNS server so it answers the queries. They may be comiNg in differently from FF due to FF/Mozilla DoH DNS implementation.