GNU bug report logs - #58520
Persistent failure to DNS-lookup hostname

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Fri, 14 Oct 2022 16:22:01 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 58520 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: bug#58520: Persistent failure to DNS-lookup hostname
Date: Sun, 17 Dec 2023 18:27:10 -0500
> P.S. It would be nice to have that patch that you mentioned that added a
>      function that fixes the broken requests.

I use the patch below.
When Emacs gets into this weird state, I do `M-: (res-init) RET` after
which I can connect again.


        Stefan


diff --git a/src/process.c b/src/process.c
index 8bc922ab509..56773fe192e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3770,6 +3769,33 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
   unbind_to (count, Qnil);
 }
 
+/* FIXME: Persistent DNS lookup errors!!
+ * Madhu <enometh <at> meer.net> suggests calling `res_init`, but that doesn't
+ * seem to exist any more in current glibc.
+ * Robert Pluim <rpluim <at> gmail.com> suggests to use
+ *
+ *    tcpdump -i any -n udp and port 53
+ *
+ * to try and see what requests are being sent out (if any) to where.
+ * Eli suggests checking systemwide DNS caches, pointing to:
+ *
+ *   https://devconnected.com/how-to-flush-dns-cache-on-linux/
+ *   https://beebom.com/how-flush-dns-cache-linux/
+ *   https://linuxize.com/post/how-to-clear-the-dns-cache/
+ *
+ * Relevant:
+ * https://sourceware.org/bugzilla/show_bug.cgi?id=984
+ */
+
+#include <resolv.h>
+
+DEFUN ("res-init", Fres_init, Sres_init, 0, 0, 0, doc: /* Run `res_init`.  */)
+  (void)
+{
+  res_init ();
+  return Qnil;
+}
+
 /* Create a network stream/datagram client/server process.  Treated
    exactly like a normal process when reading and writing.  Primary
    differences are in status display and process deletion.  A network
@@ -8821,6 +8849,7 @@ syms_of_process (void)
   defsubr (&Sserial_process_configure);
   defsubr (&Smake_serial_process);
   defsubr (&Sset_network_process_option);
+  defsubr (&Sres_init);
   defsubr (&Smake_network_process);
   defsubr (&Sformat_network_address);
   defsubr (&Snetwork_lookup_address_info);





This bug report was last modified 1 year and 181 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.