From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#71295: 29.3; url-retrieve-synchronously does not timeout if initial connection hangs Date: Sat, 8 Jun 2024 00:32:44 +0300 Message-ID: <362fabaa-0b96-42eb-8b97-b17a86a121cb@gutov.dev> References: <86bk4ko3lv.fsf@gnu.org> <19e5cb88-48a2-46a2-b9e9-c4a9c9198bb5@app.fastmail.com> <86plsuguzu.fsf@gnu.org> <86sexpff50.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14044"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: z@bcc32.com, 71295@debbugs.gnu.org, azeng@janestreet.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 07 23:42:08 2024 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 1sFhLb-0003RD-U8 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Jun 2024 23:42:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFhLJ-0008Sb-6H; Fri, 07 Jun 2024 17:41:49 -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 1sFhLH-0008SI-EK for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 17:41:47 -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 1sFhLH-0000vJ-6r for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 17:41:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sFhLW-0007VF-Cr for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 17:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Jun 2024 21:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71295 X-GNU-PR-Package: emacs Original-Received: via spool by 71295-submit@debbugs.gnu.org id=B71295.171779648728755 (code B ref 71295); Fri, 07 Jun 2024 21:42:02 +0000 Original-Received: (at 71295) by debbugs.gnu.org; 7 Jun 2024 21:41:27 +0000 Original-Received: from localhost ([127.0.0.1]:36918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFhKx-0007Ti-Dp for submit@debbugs.gnu.org; Fri, 07 Jun 2024 17:41:27 -0400 Original-Received: from fout3-smtp.messagingengine.com ([103.168.172.146]:36767) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFhKv-0007TJ-6D for 71295@debbugs.gnu.org; Fri, 07 Jun 2024 17:41:26 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfout.nyi.internal (Postfix) with ESMTP id 2F72B13800AD; Fri, 7 Jun 2024 17:32:50 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 07 Jun 2024 17:32:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1717795970; x=1717882370; bh=bjxB93sguKqR7B5qEeN7Fe8fT747LSMXoV9jmPnt5o4=; b= PfJ6HwTxRGTmlY4tWGFL197cYn6iapVrO3i5AkGEHhHePpZl7nLIqx8C4g+8DbXl PbEkR4aU0207nETbjsBd7E3DrViF/CXXVcNbA5aTYKCRTD5GcgBrrmlmdapzjFsW 6455Ozy6kYs6ggFY1m2wNlcSl5LghRMR4jOyrB7hrlRg9XDkRsM+ZDZgh2VoQnyq rmPRCB+xgT7i8KRnA9zxDPOgmCv/wEmz+O1g9n3UsrZIXbE3IfpqLa1d257lEf08 KLsNHfCe+dQbaHwcHYyjqiMCQOI3uocabd7nk1UrZ2n3HlinVcLN8POk4TAyLd5V 7Tn1qUCc9yXbciAysPQB7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1717795970; x= 1717882370; bh=bjxB93sguKqR7B5qEeN7Fe8fT747LSMXoV9jmPnt5o4=; b=D DY3AsEvhk75GMn1/75NklzBTSEjBlStHvU1oTYI9ilkd0JeKB4Ki609GY+KdipgP ZbR/ppzcTvacIdLbOVL+CZhRu8ZJ3xhYvvMuR+GeDUc35zLgigqGcsWz7AjNAMzY uSbk2NhbC/28pIV285/F5sqaztcaYp9AkK2b+6gj0HSUp0k1StREpUVpSZKDQ5vH EAw1SbfIPvDpX+cIo0S4SW73gUbsp2Dvn1XADI9YKDkY+9gcwn4xiglmTlbsij5F /CqlP/2ie7suZ3CYoPX5/ttS+nZ9Vk6GYsC1qIVye0fuTBODjqbhIRPMB7H1MoO6 FNKJajOwElLB39+iifqmg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedtuddgudefjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomhepffhm ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg htthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeufedtvddtveefhfdvveeg udejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Jun 2024 17:32:48 -0400 (EDT) Content-Language: en-US In-Reply-To: <86sexpff50.fsf@gnu.org> 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:286780 Archived-At: On 07/06/2024 09:20, Eli Zaretskii wrote: >> Date: Thu, 6 Jun 2024 23:41:39 +0300 >> Cc:71295@debbugs.gnu.org,azeng@janestreet.com >> From: Dmitry Gutov >> >> On 06/06/2024 14:40, Eli Zaretskii wrote: >>>> This is probably rather naive of me, but I guess now I'm wondering why url-retrieve-synchronously actually sets url-asynchronous to nil. Is there a good reason not to use :nowait when it is available? It seems like it would be useful to have a wrapper around url-retrieve that just "does what I mean" here. >>> Maybe. I wonder what others think about this. >> It seems like a leaky abstraction (the caller has to be aware that what >> happens under the covers is done in several steps, and the timeout only >> applies to subsequent ones). >> >> If we could change the implementation to a more intuitive behavior, that >> would be a win, I think. Can somebody think of adverse effects? > Do you have a patch to consider? This seems to work: diff --git a/lisp/url/url.el b/lisp/url/url.el index dea251b453b..3b4021ceca8 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el @@ -235,7 +235,7 @@ url-retrieve-synchronously TIMEOUT is passed, it should be a number that says (in seconds) how long to wait for a response before giving up." (url-do-setup) - (let* (url-asynchronous + (let* ((url-asynchronous t) data-buffer (callback (lambda (&rest _args) (setq data-buffer (current-buffer)) At first I was going to suggest the patch which reduces to Aaron's url-retrieve-synchronously-but-dont-hang implementation, but it misses the process cleanup stuff. The above change seems more harmless. In my brief testing anyway.