From: Dmitry Gutov <dmitry@gutov.dev>
To: Eli Zaretskii <eliz@gnu.org>
Cc: z@bcc32.com, 71295@debbugs.gnu.org, azeng@janestreet.com
Subject: bug#71295: 29.3; url-retrieve-synchronously does not timeout if initial connection hangs
Date: Mon, 10 Jun 2024 01:05:27 +0300 [thread overview]
Message-ID: <cb6f3b0e-d6ce-4751-a973-8dd4eacc5ffa@gutov.dev> (raw)
In-Reply-To: <86frtmbugm.fsf@gnu.org>
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<dmitry@gutov.dev>
>>
>> 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(#<process wrong.host.badssl.com<35>> 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 #<process wrong.host.badssl.com<35>> :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.
prev parent reply other threads:[~2024-06-09 22:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 16:21 bug#71295: 29.3; url-retrieve-synchronously does not timeout if initial connection hangs Aaron Zeng
2024-06-01 19:38 ` Eli Zaretskii
2024-06-04 0:09 ` Aaron Zeng
2024-06-06 11:40 ` Eli Zaretskii
2024-06-06 20:41 ` Dmitry Gutov
2024-06-07 6:20 ` Eli Zaretskii
2024-06-07 21:32 ` Dmitry Gutov
2024-06-08 6:08 ` Eli Zaretskii
2024-06-08 22:34 ` Dmitry Gutov
2024-06-09 4:39 ` Eli Zaretskii
2024-06-09 22:05 ` Dmitry Gutov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cb6f3b0e-d6ce-4751-a973-8dd4eacc5ffa@gutov.dev \
--to=dmitry@gutov.dev \
--cc=71295@debbugs.gnu.org \
--cc=azeng@janestreet.com \
--cc=eliz@gnu.org \
--cc=z@bcc32.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.