From: "Mattias Engdegård" <mattiase@acm.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 49449@debbugs.gnu.org
Subject: bug#49449: 28: TLS connection never gets to "open" stage
Date: Thu, 8 Jul 2021 09:59:26 +0200 [thread overview]
Message-ID: <22155A42-4A01-4EF1-80BC-B9CDE31ED0B1@acm.org> (raw)
In-Reply-To: <87lf6h3nj0.fsf@gnus.org>
7 juli 2021 kl. 21.57 skrev Lars Ingebrigtsen <larsi@gnus.org>:
> Yes, it's grown somewhat organically. :-/
Let me first say that the state of the code is not your fault! It's a product, as you say, from organic growth, and it does need a rewrite.
> I'm not able to reproduce this on Debian/bullseye, but on Macos I get
>
> callback: status = (:error (error connection-failed "connect" :host "elpa.gnu.o\
> rg" :service 443))
Yes, that is my observation too. Obviously the busy-wait part is essential: removing it makes the problem go away.
Essentially, the busy-wait postpones the call to wait_reading_process_output so that when it is eventually called, gnutls_handshake succeeds on the first try instead of first returning GNUTLS_E_AGAIN, which brings us onto a different code path.
> There's been several reports in the last week of TLS not
> working on Macos. Has Apple pushed something new, or... did something
> else happen lately in this area on Macos?
No, I've been harassed by this bug for quite some time but only now decided to dig deeper. Most likely it's just a matter of different timing that the process/TLS system doesn't cope with.
First, when the `url-http` call returns we have a Lisp_Process with
gnutls_p = true
gnutls_boot_parameters = non-nil
gnutls_initstage = GNUTLS_STAGE_HANDSHAKE_TRIED (8)
and its file descriptor has a corresponding fd_callback_data with
flags = FOR_WRITE | NON_BLOCKING_CONNECT_FD
because the asynchronous connect call has not yet been completed.
In the GOOD case (without busy-wait), `wait_reading_process_output` gets called right away (because Emacs has nothing else to do) and gnutls_try_handshake initially fails with E_AGAIN but p->outfd becomes writable so `delete_write_fd` is called to zero the fd_callback_data flags, and when the handshake eventually succeeds, the sentinel is called with the "open\n" event.
In the BAD case (with busy-wait), the TLS handshake succeeds right away while the descriptor flags still has NON_BLOCKING_CONNECT_FD set, so the sentinel isn't called.
Does this jog any memories?
next prev parent reply other threads:[~2021-07-08 7:59 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-06 19:12 bug#49449: 28: TLS connection never gets to "open" stage Mattias Engdegård
2021-07-07 19:57 ` Lars Ingebrigtsen
2021-07-08 7:59 ` Mattias Engdegård [this message]
2021-07-08 12:54 ` Lars Ingebrigtsen
2021-07-08 16:47 ` Mattias Engdegård
2021-07-10 16:27 ` Lars Ingebrigtsen
2021-07-10 16:51 ` Mattias Engdegård
2021-07-10 16:57 ` Lars Ingebrigtsen
2021-07-10 17:07 ` Mattias Engdegård
2021-07-10 18:23 ` Mattias Engdegård
2021-07-10 18:54 ` Eli Zaretskii
2021-07-10 19:22 ` Mattias Engdegård
2021-07-10 19:31 ` Eli Zaretskii
2021-07-10 19:44 ` Mattias Engdegård
2021-07-11 6:49 ` Eli Zaretskii
2021-07-11 7:42 ` Mattias Engdegård
2021-07-11 10:14 ` Eli Zaretskii
2021-07-11 14:26 ` Mattias Engdegård
2021-07-11 15:01 ` Eli Zaretskii
2021-07-12 14:57 ` Mattias Engdegård
2021-07-12 15:02 ` Lars Ingebrigtsen
2021-07-13 17:08 ` Mattias Engdegård
2021-07-10 20:05 ` Mattias Engdegård
2021-07-11 11:31 ` Lars Ingebrigtsen
2021-07-11 11:29 ` Lars Ingebrigtsen
2021-07-11 14:28 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=22155A42-4A01-4EF1-80BC-B9CDE31ED0B1@acm.org \
--to=mattiase@acm.org \
--cc=49449@debbugs.gnu.org \
--cc=larsi@gnus.org \
/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.