From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alain Schneble Newsgroups: gmane.emacs.devel Subject: Re: Asynchronous DNS Date: Sat, 20 Feb 2016 20:57:01 +0100 Message-ID: <8660xj40ky.fsf@realize.ch> References: <87h9hrnc8x.fsf@gnus.org> <83powfzsqt.fsf@gnu.org> <87y4b393hl.fsf@gnus.org> <83io27ytu3.fsf@gnu.org> <87k2mmzkry.fsf@gnus.org> <83k2mlyet8.fsf@gnu.org> <87lh71nriy.fsf@gnus.org> <8637t8opla.fsf@realize.ch> <871t8skg6c.fsf@gnus.org> <86y4b0n5q2.fsf@realize.ch> <87fux7gb7o.fsf@gnus.org> <83wpqjvd2f.fsf@gnu.org> <87zivfobn4.fsf@gnus.org> <86y4ao5g1c.fsf@realize.ch> <87r3ggdo9f.fsf@gnus.org> <86twlb5yl4.fsf@realize.ch> <83d1rzz1mu.fsf@gnu.org> <86egcc49qu.fsf@realize.ch> <87io1k41cg.fsf@gnus.org> <86a8mv41s5.fsf@realize.ch> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1455998272 24143 80.91.229.3 (20 Feb 2016 19:57:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Feb 2016 19:57:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 20 20:57:45 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aXDey-0000KJ-Vj for ged-emacs-devel@m.gmane.org; Sat, 20 Feb 2016 20:57:45 +0100 Original-Received: from localhost ([::1]:35265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXDey-0008Gg-Eb for ged-emacs-devel@m.gmane.org; Sat, 20 Feb 2016 14:57:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXDek-0008Dc-UD for emacs-devel@gnu.org; Sat, 20 Feb 2016 14:57:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXDef-0001tW-VE for emacs-devel@gnu.org; Sat, 20 Feb 2016 14:57:30 -0500 Original-Received: from clientmail.realize.ch ([46.140.89.53]:4547) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1aXDef-0001tR-HK for emacs-devel@gnu.org; Sat, 20 Feb 2016 14:57:25 -0500 Original-Received: from rintintin.hq.realize.ch.lan.rit ([192.168.0.105]) by clientmail.realize.ch ; Sat, 20 Feb 2016 20:57:14 +0100 Original-Received: from MYNGB (192.168.66.64) by rintintin.hq.realize.ch.lan.rit (192.168.0.105) with Microsoft SMTP Server (TLS) id 15.0.516.32; Sat, 20 Feb 2016 20:57:05 +0100 In-Reply-To: <86a8mv41s5.fsf@realize.ch> (Alain Schneble's message of "Sat, 20 Feb 2016 20:31:06 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt) X-ClientProxiedBy: rintintin.hq.realize.ch.lan.rit (192.168.0.105) To rintintin.hq.realize.ch.lan.rit (192.168.0.105) X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] X-Received-From: 46.140.89.53 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:200336 Archived-At: --=-=-= Content-Type: text/plain Alain Schneble writes: > But what seems strange to me right now is this code in check_for_dns: > > /* The DNS lookup failed. */ > else if (!EQ (p->status, Qconnect)) > { > ... > > Actually, I tried it out and DNS lookups seem to timeout quite fast on > my machine if there is no network connection. But they do not enter the > if-branch above. That seems like an error. Am I day-dreaming or > shouldn't it be rewritten to look like this? > > /* The DNS lookup failed. */ > else if (EQ (p->status, Qconnect)) > { > ... And here is the patch. It indeed seems to resolve the issue. And another one as well. Before, if DNS lookup of at least one process failed and Emacs was requested to terminate (C-x C-c, save-buffers-kill-terminal), it hung. Because there was still one or several processes in "connect" state. It was stuck in wait_for_socket_fds. Maybe there are other cases where it still does not behave properly, also after having applied this patch. I'll try to understand the other branches, where the process state won't be touched even if DNS request failed... --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename="0001-Deactivate-process-if-async-DNS-request-failed-bugfi.patch" Content-Description: Patch >From 05ba5057d1ce2394fdaf8d246523166360d3fe89 Mon Sep 17 00:00:00 2001 From: Alain Schneble Date: Sat, 20 Feb 2016 20:37:45 +0100 Subject: [PATCH] Deactivate process if async DNS request failed (bugfix) * src/process.c (check_for_dns): If the async DNS request failed and the associated process is still in "connect" state, deactivate the process and set status to "failed". --- src/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/process.c b/src/process.c index a59e418..1f83327 100644 --- a/src/process.c +++ b/src/process.c @@ -4706,7 +4706,7 @@ check_for_dns (Lisp_Object proc) ip_addresses = Fnreverse (ip_addresses); } /* The DNS lookup failed. */ - else if (!EQ (p->status, Qconnect)) + else if (EQ (p->status, Qconnect)) { deactivate_process (proc); pset_status (p, (list2 -- 2.6.2.windows.1 --=-=-=--