Subject: Re: bug#39158: 26.1; url-retrieve-synchronously possible race condition

From: Noam Postavsky <[email-masked]>
Date: Fri, 17 Jan 2020 12:46:01 -0500

unarchive 34341
forcemerge 34341 39158
quit

Ernesto Alfonso <[email-masked]> writes:

> url-retrieve-synchronously unexpectedly returns an empty buffer:
>
> emacs -Q --eval '(with-current-buffer (url-retrieve-synchronously "
> https://google.com") (print (buffer-string)))' --batch
> Contacting host: google.com:443
>
> ""
>
> If I add (sit-for 2) in url-retrieve-synchronously after the (url-retrieve
> ...) call:
>
>     (setq asynch-buffer
>      (url-retrieve url (lambda (&rest ignored)
>          (url-debug 'retrieval "Synchronous fetching done (%S)"
> (current-buffer))
>          (setq retrieval-done t
>        asynch-buffer (current-buffer)))
>     nil silent inhibit-cookies))
>     (sit-for 2)
>
> then I see the expected output.
>
>
> In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)

Looks like Bug#34341, try upgrading to 26.3, or put

    (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")

in your init file as a temporary workaround.