Subject: Re: bug#58520: Persistent failure to DNS-lookup hostname

From: Stefan Monnier <[email-masked]>
Date: Fri, 03 Nov 2023 12:38:03 -0400

> FWIW, I experience this sometimes when I change from an Ethernet
> connection to a WiFi connection (I cannot remember if the inverse is
> true too).  This change to another connection once I wake my laptop from
> hibernation.  During this change, /etc/resolv.conf definitely changes
> because I use resolvconf to set connection-specific and
> interface-specific DNS nameserver setting.  [ I need to set the DNS
> server manually for the Ethernet connection but I can use dhcp for the
> Wifi one.  ]

Sounds like the exact same problem, indeed.
If you ever come up with some further hints about what it needs to
reproduce it (or even better: an actual recipe), I'd be happy to hear them.

Currently it seems that hibernate/suspend might be related, tho
I suspect it's a red herring.

> The other super weird part is that eww _can_ open debbugs.gnu.org just
> fine, but if I use Gnus to fetch the bug report it doesn't...

Hmm... any chance that you're using some package which makes `eww` use
some external tool instead of `url.el`?

> I am not sure how long this failing Emacs instance will fail but if it
> helps, I can try to do some debugging on my end as well.

AFAICT once it happens it doesn't fix itself: the DNS server used by
your Emacs process is "stuck" and doesn't pay attention to
/etc/resolv.conf, so it "gets fixed" if you happen to be connected on
a network where the DNS server that Emacs tries to contact is available.

> I tried to use tcpdump but the manpage seems to suggest that there is
> no way to filter network requests made by a particular process, and
> I see too many junk requests to isolate the traffic that matters.

I used a filter which only kept packets sent to a DNS port (port 53) and
that was sufficient to see requests to the "wrong" DNS server (e.g. the
one you use when your machine is connected via Ethernet, even though
the machine is currently connected via wifi) and to confirm that those
requests are correlated with the operation I perform in Emacs.

        Stefan