unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Gutov <dmitry@gutov.dev>
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: Sat, 08 Jun 2024 09:08:39 +0300	[thread overview]
Message-ID: <86r0d8dl08.fsf@gnu.org> (raw)
In-Reply-To: <362fabaa-0b96-42eb-8b97-b17a86a121cb@gutov.dev> (message from Dmitry Gutov on Sat, 8 Jun 2024 00:32:44 +0300)

> Date: Sat, 8 Jun 2024 00:32:44 +0300
> Cc: z@bcc32.com, 71295@debbugs.gnu.org, azeng@janestreet.com
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> 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<dmitry@gutov.dev>
> >>
> >> 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?





  reply	other threads:[~2024-06-08  6:08 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 [this message]
2024-06-08 22:34               ` Dmitry Gutov
2024-06-09  4:39                 ` Eli Zaretskii
2024-06-09 22:05                   ` Dmitry Gutov

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86r0d8dl08.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=71295@debbugs.gnu.org \
    --cc=azeng@janestreet.com \
    --cc=dmitry@gutov.dev \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).