From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71295: 29.3; url-retrieve-synchronously does not timeout if initial connection hangs Date: Sat, 08 Jun 2024 09:08:39 +0300 Message-ID: <86r0d8dl08.fsf@gnu.org> References: <86bk4ko3lv.fsf@gnu.org> <19e5cb88-48a2-46a2-b9e9-c4a9c9198bb5@app.fastmail.com> <86plsuguzu.fsf@gnu.org> <86sexpff50.fsf@gnu.org> <362fabaa-0b96-42eb-8b97-b17a86a121cb@gutov.dev> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1972"; mail-complaints-to="usenet@ciao.gmane.io" Cc: z@bcc32.com, 71295@debbugs.gnu.org, azeng@janestreet.com To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 08 08:10:17 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 1sFpHN-0000Ha-D9 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 Jun 2024 08:10:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFpGu-0006iE-Od; Sat, 08 Jun 2024 02:09:48 -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 1sFpGt-0006hy-Ii for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2024 02:09: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 1sFpGt-00019B-At for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2024 02:09:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sFpH8-000745-Cp for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2024 02:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Jun 2024 06:10: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.171782694726991 (code B ref 71295); Sat, 08 Jun 2024 06:10:02 +0000 Original-Received: (at 71295) by debbugs.gnu.org; 8 Jun 2024 06:09:07 +0000 Original-Received: from localhost ([127.0.0.1]:46415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFpGF-00071G-Bl for submit@debbugs.gnu.org; Sat, 08 Jun 2024 02:09:07 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFpGC-00070Z-72 for 71295@debbugs.gnu.org; Sat, 08 Jun 2024 02:09:05 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFpFq-00015Z-RG; Sat, 08 Jun 2024 02:08:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=L4wbw8tofxCcnXtmYRdzE7plCijSDXfQvfMYMlxZXmw=; b=GxYYAzsGY/VM 8yePM3oKTPXj00QwtuSCeiKtc4KejFI6dhNFLzmoekzZQtycGXmf+lAKH8UieI1NILUhP9KvGyRop Oewt7Iau/g2c7WUxRxy2AFd/raHTENpE5Ctm72Gv+bmvFuglOC02TfFxxtonQ/AYQQuApHoAh1KVq 0lNyIQyHRLnlCplDWhVLNNLCOHUQxZ6abKV+HWMswqLATYfamfZgVR9Qaxb3NjdMcNeLoXK3jDL2R 5sqhNEPvmxwOPQi6IbZD3BamXmRzSXGKI7CD2MT8+0QghlbpvZ6aPPqaT1A3fGcX261ifhWG/qcFe tZU25yxd6HSCpObBaGVJlQ==; In-Reply-To: <362fabaa-0b96-42eb-8b97-b17a86a121cb@gutov.dev> (message from Dmitry Gutov on Sat, 8 Jun 2024 00:32:44 +0300) 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:286811 Archived-At: > Date: Sat, 8 Jun 2024 00:32:44 +0300 > Cc: z@bcc32.com, 71295@debbugs.gnu.org, azeng@janestreet.com > From: Dmitry Gutov > > 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 > >> > >> 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)) Fine by me to install this on master, but please add there a comment explaining why we do that disregarding the "synchronously" part of the API's name. Did you consider binding url-asynchronous non-nil only if TIMEOUT is omitted or nil? That could be even better, since the risk of breaking something is lower, and OTOH if TIMEOUT is not passed, the original problem does not exist and waiting "forever" is justified. WDYT?