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, 27 Feb 2016 10:22:47 +0100 Message-ID: <86wppqv76g.fsf@realize.ch> References: <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> <56C8A89C.4020909@cs.ucla.edu> <861t873zlj.fsf@realize.ch> <56C8CD9D.1020504@cs.ucla.edu> <86twl22w7b.fsf@realize.ch> <87povils9h.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1456565422 6378 80.91.229.3 (27 Feb 2016 09:30:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Feb 2016 09:30:22 +0000 (UTC) Cc: Paul Eggert , YAMAMOTO Mitsuharu , emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 27 10:30:21 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 1aZbCe-0001by-Rc for ged-emacs-devel@m.gmane.org; Sat, 27 Feb 2016 10:30:20 +0100 Original-Received: from localhost ([::1]:54106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZbCe-0005Xh-DL for ged-emacs-devel@m.gmane.org; Sat, 27 Feb 2016 04:30:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZb6L-0004Ep-7S for emacs-devel@gnu.org; Sat, 27 Feb 2016 04:23:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZb6H-000636-Bu for emacs-devel@gnu.org; Sat, 27 Feb 2016 04:23:49 -0500 Original-Received: from clientmail.realize.ch ([46.140.89.53]:1914) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1aZb6G-00062u-WF for emacs-devel@gnu.org; Sat, 27 Feb 2016 04:23:45 -0500 Original-Received: from rintintin.hq.realize.ch.lan.rit ([192.168.0.105]) by clientmail.realize.ch ; Sat, 27 Feb 2016 10:23:22 +0100 Original-Received: from MYNGB (192.168.250.224) by rintintin.hq.realize.ch.lan.rit (192.168.0.105) with Microsoft SMTP Server (TLS) id 15.0.516.32; Sat, 27 Feb 2016 10:23:02 +0100 In-Reply-To: <87povils9h.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 27 Feb 2016 14:27:30 +1030") 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:200709 Archived-At: Lars Ingebrigtsen writes: > YAMAMOTO Mitsuharu writes: > >> The man page says gai_cancel does not cancel the request if it is >> currently being processed. So I suspect it is unsafe to free struct >> gaicb by calling free_dns_request if the request was not canceled >> actually. > > Yes, I think you're right. If we check the status and it's > EAI_CANCELLED, then it's safe to free the request. However, what do we > do if it isn't safe? This is in `delete-process', so the process object > itself is going to go away, and then we lose track of p->dns_request, so > we can't free it. I think. > > Anybody got any ideas for scheduling that free_dns_request? I see these options: 1. Suspend the thread using gai_suspend, waiting for the DNS request to complete. 2. Calling a "blocker" similar to wait_for_socket_fds, to wait for DNS request completion in a loop. But this would need additional logic in wait_reading_process_output, to not proceed with connect_network_socket in case process deletion is pending. 3. Any other way of postponing freeaddrinfo. I'm not sure, but my gut feeling says that option #1 may be acceptable in this situation. We might run into "suspend" only in corner cases, if the process is being deleted while a request is still being processed.