unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Visuwesh <visuweshm@gmail.com>
Cc: 58520@debbugs.gnu.org, Paul Eggert <eggert@cs.ucla.edu>
Subject: bug#58520: Persistent failure to DNS-lookup hostname
Date: Sun, 17 Dec 2023 18:27:10 -0500	[thread overview]
Message-ID: <jwvwmtccsxr.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87fs09uf7z.fsf@gmail.com> (Visuwesh's message of "Mon, 11 Dec 2023 17:24:24 +0530")

> 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);






  reply	other threads:[~2023-12-17 23:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 16:20 bug#58520: Persistent failure to DNS-lookup hostname Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-14 16:55 ` Paul Eggert
2022-10-14 17:17   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-05 17:06 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-03  7:57   ` Visuwesh
2023-11-03 16:38     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-03 18:46       ` Visuwesh
2023-11-03 21:54         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-04  2:31           ` Visuwesh
2023-12-11 11:54             ` Visuwesh
2023-12-17 23:27               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-12-18 17:30                 ` Eli Zaretskii
2023-12-18 17:41                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-18 17:55                     ` Eli Zaretskii
2023-12-18 18:26                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvwmtccsxr.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=58520@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=monnier@iro.umontreal.ca \
    --cc=visuweshm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).