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: Mon, 10 Jun 2024 01:05:27 +0300 Message-ID: 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> <86r0d8dl08.fsf@gnu.org> <57c87a3e-d2bc-45aa-9c67-5ad62e82481f@gutov.dev> <86frtmbugm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9569"; 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 Mon Jun 10 00:26:07 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 1sGQzG-0002Dq-Lg for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Jun 2024 00:26:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sGQyy-0000aK-Jy; Sun, 09 Jun 2024 18:25: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 1sGQyw-0000Yv-IZ for bug-gnu-emacs@gnu.org; Sun, 09 Jun 2024 18:25:46 -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 1sGQyw-0002jb-Ak for bug-gnu-emacs@gnu.org; Sun, 09 Jun 2024 18:25:46 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sGQzC-0002GP-TI for bug-gnu-emacs@gnu.org; Sun, 09 Jun 2024 18:26: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: Sun, 09 Jun 2024 22:26: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.17179719288601 (code B ref 71295); Sun, 09 Jun 2024 22:26:02 +0000 Original-Received: (at 71295) by debbugs.gnu.org; 9 Jun 2024 22:25:28 +0000 Original-Received: from localhost ([127.0.0.1]:36173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sGQyc-0002EX-KS for submit@debbugs.gnu.org; Sun, 09 Jun 2024 18:25:28 -0400 Original-Received: from wfhigh7-smtp.messagingengine.com ([64.147.123.158]:54379) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sGQl2-0001cu-Og for 71295@debbugs.gnu.org; Sun, 09 Jun 2024 18:11:26 -0400 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.west.internal (Postfix) with ESMTP id 7315E18000B3; Sun, 9 Jun 2024 18:05:31 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 09 Jun 2024 18:05:31 -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=1717970731; x=1718057131; bh=Eg9gLah4is4m2IgIwoz+gXedgh8DygAlZKj29P4+PBE=; b= Qk6mXL2m5ZyK937PKCc1zwS+h0D+P8xl4sXTmqEUPNm94WKlDoMHzw0KhJEVyV7V AGIgNImfEb3ZfmM6qSq9pc6f0g2qWtxvNDzUFoXVcFGK3CQR+42AO0ORrLjWMznM x1g6mp3e4B5k31TYKlVWRlzfwfKlBsxFFWbur+9KzhqvzRY6304v708QGlKZYsDg Ny0Jc6GyfcsQyCjs58oeEDcdp4/uc+A4wDRSstDx9ujJ3DIxPiiRS6s8UjjikA1r VMYMX6JLy1aNzBfJ3kBm1WB2yvaFmjC1Wv2Fwy4YVbO9tzXHOnb+QJu0sx5Qb8s0 JCjuYiR29GvSS6X93CoTMA== 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=1717970731; x= 1718057131; bh=Eg9gLah4is4m2IgIwoz+gXedgh8DygAlZKj29P4+PBE=; b=Y WXGvDm37qXDyswXtI4Ao0cWaMDOyahU9YKf+hjrE3QN+JyTj9PW1SvbPt2WAg5aH AkUO8tXycp3ezl2bnatzq4rK8YnEzpmN9Ih4kfagpW37F0n1P0B0BXpN+8rsRo4P WoN58AHsaLBvExwT2EhPxpfY3Yj+xrJBpZUSvFdUvAs/SJGkiS+jb6HE2lekPyoQ ypRSQkWEl5JpXRPh94vkVAWwIcTwp4VGjvSnZE3QpcgMwIDhxNcliY6fnYf0VrDt dupGjHU3GYEnqmxbt3Jj9P2vIbBNzcY2Aq0WDIZUU5dOXI4TlfwLDHqlZsWypO7j rmmAwcuSZ1OoLYnU2Cp4A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedtkedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepveevudegtdeuueeugeefjeeludejhfeuvefgtddtteethfelgffhjefhffel teeknecuffhomhgrihhnpegsrggushhslhdrtghomhenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 9 Jun 2024 18:05:29 -0400 (EDT) Content-Language: en-US In-Reply-To: <86frtmbugm.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:286996 Archived-At: On 09/06/2024 07:39, Eli Zaretskii wrote: >> Date: Sun, 9 Jun 2024 01:34:03 +0300 >> Cc:z@bcc32.com,71295@debbugs.gnu.org,azeng@janestreet.com >> From: Dmitry Gutov >> >> Thinking further, though, our ability to do so bring the existence of >> this variable into question (we only change it in >> url-retrieve-synchronously). >> >> I see it's been added as part of bug#26835 resolution, so maybe we'll >> need to re-examine that fix. > Maybe. Suggestions welcome. This seems to work: diff --git a/lisp/url/url.el b/lisp/url/url.el index 0ac2917b213..1972ff254fe 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el @@ -245,7 +245,8 @@ url-retrieve-synchronously data-buffer))) (start-time (current-time)) (proc-buffer (url-retrieve url callback nil silent - inhibit-cookies))) + inhibit-cookies)) + failed-message) (if (not proc-buffer) (url-debug 'retrieval "Synchronous fetching unnecessary %s" url) (unwind-protect @@ -276,6 +277,8 @@ url-retrieve-synchronously ;; Process sentinel vagaries occasionally cause ;; url-retrieve to fail calling callback. (unless data-buffer + (when (memq (process-status proc) '(signal failed)) + (setq failed-message (process-exit-status proc))) (url-debug 'retrieval "Dead process %s" url) (throw 'done 'exception)))) ;; Querying over consumer internet in the US takes 100 @@ -285,7 +288,9 @@ url-retrieve-synchronously (when (and data-buffer (not (eq data-buffer proc-buffer))) (let (kill-buffer-query-functions) - (kill-buffer proc-buffer))))) + (kill-buffer proc-buffer)))) + (when failed-message + (error "Retrieval failed: `%s'" failed-message))) data-buffer)) ;; url-mm-callback called from url-mm, which requires mm-decode. It's doesn't show the same kind of error like the nowait version: Debugger entered--Lisp error: (error "The x509 certificate does not match \"wrong.host.badssl.com\"") gnutls-boot(#> gnutls-x509pki (:complete-negotiation t :priority "NORMAL:%DUMBFW" :hostname "wrong.host.badssl.com" :loglevel 0 :min-prime-bits nil :trustfiles ("/etc/ssl/certs/ca-certificates.crt") :crlfiles nil :keylist nil :verify-flags nil :verify-error t :pass nil :flags nil :callbacks nil)) gnutls-negotiate(:process #> :type gnutls-x509pki :keylist nil :hostname "wrong.host.badssl.com") But the error is still meaningful: (error "Retrieval failed: ‘The Network Security Manager stopped the connections’") Unfortunately, the error is sometimes not triggered (the process object not created maybe?) - so some more investigation is needed.