From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#58520: Persistent failure to DNS-lookup hostname Date: Fri, 03 Nov 2023 13:27:21 +0530 Message-ID: <875y2j9sm6.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7011"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 58520@debbugs.gnu.org, Paul Eggert To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 03 08:58:59 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qyp4z-0001YS-OL for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Nov 2023 08:58:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyp4X-0000hC-41; Fri, 03 Nov 2023 03:58:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qyp4U-0000h0-Op for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 03:58:26 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyp4U-0003Xs-Gh for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 03:58:26 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qyp53-0004uP-T8 for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 03:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Nov 2023 07:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58520 X-GNU-PR-Package: emacs Original-Received: via spool by 58520-submit@debbugs.gnu.org id=B58520.169899829718796 (code B ref 58520); Fri, 03 Nov 2023 07:59:01 +0000 Original-Received: (at 58520) by debbugs.gnu.org; 3 Nov 2023 07:58:17 +0000 Original-Received: from localhost ([127.0.0.1]:56690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyp4H-0004sy-3i for submit@debbugs.gnu.org; Fri, 03 Nov 2023 03:58:17 -0400 Original-Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:60649) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyp4B-0004sN-Fi for 58520@debbugs.gnu.org; Fri, 03 Nov 2023 03:58:11 -0400 Original-Received: by mail-pf1-x442.google.com with SMTP id d2e1a72fcca58-6c3077984e8so1737536b3a.0 for <58520@debbugs.gnu.org>; Fri, 03 Nov 2023 00:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698998245; x=1699603045; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=G9guz7XmBhJvBjbI0NwZBjHXitEISjQnR0S95YftfF0=; b=OAyHLxsXf0mLpKAXuR1mTJYzB5OMhBnAV2EpC9QY1KhbOdEZWRqcNEPUXZjOgDV2Z1 6b9p3LLNWMvHMlTdmIR50dCZJ2wOvbi1Ve28bI5CvLIL88N7xU2XG79C4Wc9dBuK9/sz LYwlyFvNDZDoeZgHbvTZ00pZ0pqQCnzaOnCgK6MMJHS/zwocon9h3bdifTGhgvgfV+Wx TYk7D4OuWAbnkhPDXSR6lXweOTVIWSNcn2GjCl6o1G23u2rE6MI4DkMEy8sAEY39hPX8 b/Yjhyw7sxWzfD+pXtTLGsQfu0HxQigzXP4E8f8xjiIr9mr+JeLWS3k+UiKPdgb4Eo6V MPEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698998245; x=1699603045; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=G9guz7XmBhJvBjbI0NwZBjHXitEISjQnR0S95YftfF0=; b=h9T9QnOEYLho2Ljo4+tD9JmNkO7ZDA/w6ZTL22dZE9YfeXTiuQU1LCNf2eKETSfd1H kTZsV4poW9xsowBOyvK3Hr5gD07WeFduza7LTBdzItY62Tt4UurFdC4h3V0vLnLX/kDE bGiha8XDvFMcWgxlUyKdYkPjHBQD4S4ID5+R+sfL8DLUKrDIhFFkrK57qhTSRES3Rr6M pEtPEnLhIrpmnvTs/NhaBaaerUwwuOHNujdEZQENDbL4Disw7Q1C/vFjLkg2Qa7eNZJP ubWP0dOK64kB7xilrNunwJ1PnrerC0756WMu00b/XWtTEDyo4RhmPc+Ef4mEHtJAMkpx /QWg== X-Gm-Message-State: AOJu0YwXQFtfFSzudTcOUmznCBrP8vwd4aGAkPU0ZBK6hryMk6BWiSki EalnKbYcfUsFxf/AESyrTsY= X-Google-Smtp-Source: AGHT+IHaT6LSopoTyZ7R3bCkyGKIYCjO040x2ro1hB5vAUonTxp6OQn6V2+3dxQVyYKoUbU0Z+O7+g== X-Received: by 2002:a05:6a21:71c6:b0:181:b044:44a4 with SMTP id ay6-20020a056a2171c600b00181b04444a4mr4252093pzc.56.1698998245469; Fri, 03 Nov 2023 00:57:25 -0700 (PDT) Original-Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id a7-20020a17090a688700b0027df6ff00eesm797679pjd.19.2023.11.03.00.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 00:57:24 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Tue, 05 Sep 2023 13:06:11 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273698 Archived-At: [Tuesday September 05, 2023] Stefan Monnier wrote: > FWIW, I've seen this bug on a somewhat regular basis. I have not been > able to reproduce it: it seems to show up only after Emacs has been in > use for several days. > > I did confirm that calling `M-: (res-init) RET` does work around the > problem in the sense that the Emacs session can then successfully > perform DNS lookups again. > [ `res-init` is a little DEFUN I added which just calls `res_init`. ] > > So, as far as I can tell, the problem is that glibc or Emacs somehow get > into a state where the automatic decision to refresh the info about the > address of the DNS server doesn't work any more. > 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. ] Emacs throws me `443 Temporary failure in name resolution' even though I can open the same address in Firefox, or a fresh new Emacs instance just fine. In fact, I couldn't use gnus-read-ephemeral-emacs-bug-group from the failing Emacs instance but I can in this fresh one I opened just to send this mail. 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... More generally, eww seems to be able to open these webpages just fine but if I do a HTTP request to same address using url.el it fails with the aforementioned 443 error. I can sometimes stop this error once and for all by visiting the failing address in eww but clearly this time it hasn't helped (since Gnus still fails to make a connection to debbugs.gnu.org after visiting debbugs.gnu.org in eww). 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. 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. > Stefan > > > Stefan Monnier [2022-10-14 12:20:52] wrote: > >> Package: Emacs >> >> >> [ I see that my original email was sent to emacs-devel, but I think >> bug-gnu-emacs is a better place for that. ] >> >> My Gnus session (a separate Emacs session I use specifically to run >> Gnus) occasionally gets into a state where it insists that my mail >> server's DNS name isn't found. All(?) other processes on the machine >> keep happily resolving hostname, so the problem is specific to >> this process. >> >> The problem just reappeared today and thanks to the help I got last time >> I managed to diagnose it a bit better: >> >> - Lars asked if it only affect IMAP: nope, it affects more than just >> IMAP. Simple tests suggest it affects all DNS lookups performed by >> that Emacs process. >> - Madhu suggested the problem was related to commit 93bf7d52841c60ff and >> might be linked to a lack of call to `res_init`. For some stupid >> reason I wasn't able to add an ELisp primitive that lets me call >> `res_init` manually to verify this hypothesis, but I now figured what >> was my mistake, so I should be able to try `M-: (res-init) RET` next time >> to confirm that it works around the problem. >> - Robert's suggestion to use `tcpdump` showed that the reason this Emacs >> process gets DNS lookup failures is simply that it queries the DNS >> server at 192.168.1.1 which is the server I was using yesterday (and >> to which I currently don't have access) rather than the one I'm using >> now. IOW, it strongly suggests that the problem would be solved by >> calling `res_init`. >> >> [Glibc bug 984](https://sourceware.org/bugzilla/show_bug.cgi?id=984) >> seems relevant. According to this, calling `res_init` should not be >> necessary any more. Indeed, if I start Emacs, use >> `make-network-process`, then change `/etc/resolv.conf`, then call >> `make-network-process` again, tcpdump shows clearly that the Emacs >> session has noticed the change in `/etc/resolv.conf`. I tried this same >> test from a fresh new Gnus session, and that also works fine. >> >> So it's still a mystery why my Gnus session sometimes gets into a state >> where it apparently stops paying attention to changes in >> `/etc/resolv.conf`. The above bug 984 mentions that glibc's "auto >> reload" of `/etc/resolv.conf` is prevented in case the application has >> modified `_res` manually, but I can't see any place where we do that. >> Could it be that some of the libraries we link with can sometimes >> manually modify `_res`? >> >> >> Stefan