unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: 36017@debbugs.gnu.org
Cc: Joseph Mingrone <jrm@ftfl.ca>, Robert Pluim <rpluim@gmail.com>,
	Noam Postavsky <npostavs@gmail.com>,
	Aaron Jensen <aaronjensen@gmail.com>
Subject: bug#36017: 27.0.50; TLS 1.3 on macOS exhibits similar issue to  #34341
Date: Mon, 7 Oct 2019 17:02:25 +0200	[thread overview]
Message-ID: <489730AF-5AF8-43D6-BCBE-0B1008BC1DE4@acm.org> (raw)
In-Reply-To: <m2sgsvl7n8.fsf@gmail.com>

There seems to be a race of some kind.

On macOS 10.14 and Emacs master, NS build, `list-packages' (with only elpa.gnu.org configured) fails while fetching archive-contents asynchronously. However, running

(url-retrieve
 "https://elpa.gnu.org/packages/archive-contents"
 (lambda (status) (message "callback: status = %S" status))
 nil
 'silent)

works (albeit slowly); this is (modulo the callback) what list-packages does behind the curtains. The only difference is that list-packages then immediately proceeds with some other work (package-menu--refresh). This can be simulated with

(progn
 (url-retrieve ...)  ; like above
 (busy-wait 1.0))    ; busy-wait 1 s

which fails in the same way. As reported by Joseph Mingrone, the process sentinel, `url-http-async-sentinel', is called with a WHY argument of "connect", which makes little sense; if the process is still trying to connect, why is the sentinel called?

In any case, `url-http-async-sentinel' interprets the "connect" status as an error and fails, but this is just a symptom of something earlier; changing the sentinel to ignore "connect" doesn't help.

If run in a TTY (with -nw), everything works, further indicating that it's may be a problem with handling of asynchronous processes in the NS build.

However, this seems insufficient by itself: is gnutls (or TLS 1.3) really so brittle that it cannot cope with a mere delay of 1 s during the initial handshake?

More details:

* In all runs, gnutls_handshake fails when called right after the initial connect() in connect_network_socket; this is expected since the socket is nonblocking and the TCP connection hasn't been set up yet.

* In failed runs, gnutls_handshake succeeds immediately in wait_reading_process_output.

* In successful runs, gnutls_handshake initially fails (with GNUTLS_E_AGAIN) in wait_reading_process_output. Only after several tries does it return success.

I didn't make much progress beyond this point. Could someone more familiar with gnutls in Emacs help me debug it?






  parent reply	other threads:[~2019-10-07 15:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  1:44 bug#36017: 27.0.50; TLS 1.3 on macOS exhibits similar issue to #34341 Aaron Jensen
2019-06-03  9:11 ` Robert Pluim
2019-06-03  9:53   ` Aaron Jensen
2019-06-03 10:05     ` Robert Pluim
2019-06-03 15:21       ` Aaron Jensen
2019-06-03 16:37         ` Aaron Jensen
2019-06-03 16:41       ` Alan Third
2019-06-03 16:42         ` Aaron Jensen
2019-06-03 17:47       ` Robert Pluim
2019-06-03 18:38         ` Robert Pluim
2019-06-03 19:05           ` Robert Pluim
2019-06-04 13:12         ` Noam Postavsky
2019-06-04 13:25           ` Robert Pluim
2019-08-07 18:34     ` Joseph Mingrone
2020-08-03  8:02     ` Lars Ingebrigtsen
2020-08-03 15:52       ` Aaron Jensen
2020-08-04  3:40         ` Richard Stallman
2020-08-04  8:23         ` Lars Ingebrigtsen
2019-10-07 15:02 ` Mattias Engdegård [this message]
     [not found] <0DD0E210-B1FD-4361-930E-5A4A0DBA1796@acm.org>
2021-07-13  9:03 ` Mattias Engdegård

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=489730AF-5AF8-43D6-BCBE-0B1008BC1DE4@acm.org \
    --to=mattiase@acm.org \
    --cc=36017@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    --cc=jrm@ftfl.ca \
    --cc=npostavs@gmail.com \
    --cc=rpluim@gmail.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).