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: Tue, 2 Feb 2016 22:27:33 +0100 Message-ID: <867fimola2.fsf@realize.ch> References: <87si1gx6wz.fsf@gnus.org> <86y4b5zvzt.fsf@gmail.com> <8760y9kwrk.fsf@gnus.org> <87wpqpjgwy.fsf@gnus.org> <83a8nk1cxk.fsf@gnu.org> <87h9hrnc8x.fsf@gnus.org> <86io27obqf.fsf@realize.ch> <878u331tht.fsf@gnus.org> <86egcvo8ky.fsf@realize.ch> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1454448501 31256 80.91.229.3 (2 Feb 2016 21:28:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Feb 2016 21:28:21 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 02 22:28:16 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 1aQiUh-0003mJ-KP for ged-emacs-devel@m.gmane.org; Tue, 02 Feb 2016 22:28:15 +0100 Original-Received: from localhost ([::1]:59559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQiUh-0003d6-1D for ged-emacs-devel@m.gmane.org; Tue, 02 Feb 2016 16:28:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQiUX-0003Tv-Ox for emacs-devel@gnu.org; Tue, 02 Feb 2016 16:28:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQiUT-0002h0-SC for emacs-devel@gnu.org; Tue, 02 Feb 2016 16:28:05 -0500 Original-Received: from clientmail.realize.ch ([46.140.89.53]:1823) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1aQiUP-0002gC-1z; Tue, 02 Feb 2016 16:27:57 -0500 Original-Received: from rintintin.hq.realize.ch.lan.rit ([192.168.0.105]) by clientmail.realize.ch ; Tue, 2 Feb 2016 22:27:42 +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; Tue, 2 Feb 2016 22:27:25 +0100 In-Reply-To: <86egcvo8ky.fsf@realize.ch> (Alain Schneble's message of "Tue, 2 Feb 2016 08:49:33 +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:199191 Archived-At: Alain Schneble writes: > Lars Ingebrigtsen writes: > >> I'm guessing they'll die along with Emacs. That's what happens with >> threads started by libraries currently, I think. > > If so, depending on how network resources are used, it may not release > them properly. They /might/ be released while the process is being > stopped. But will they be released in any case? After all, it sounds a > bit awkward to rely on such a behavior even if it would just work. > Doesn't it? Well, I now see that the async dns lookup is initiated using `getaddrinfo_a' with GAI_NOWAIT and what it does behind the scenes is hidden. As Florian pointed out, it uses threads under the cover. But maybe it's not relevant at all for this discussion. But still, I wonder why there is no call to `gai_cancel' at all. In `wait_reading_process_output', there is the call to `check_for_dns'. I would expect a call to `gai_cancel' somewhere in `wait_reading_process_output' or the like to explicitly cancel the corresponding pending async request(s), e.g. when cancelling with `C-g' or when killing the process. Am I missing something? Or would that just be a nicety that nobody cares about? And please bear with me, it's the first time I look into `process.c' (and c source code as well...). Thanks! Alain