[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58520: Persistent failure to DNS-lookup hostname
From: |
Stefan Monnier |
Subject: |
bug#58520: Persistent failure to DNS-lookup hostname |
Date: |
Sun, 17 Dec 2023 18:27:10 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> 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@meer.net> suggests calling `res_init`, but that doesn't
+ * seem to exist any more in current glibc.
+ * Robert Pluim <rpluim@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);