all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Derek Zhou <derek@3qin.us>
To: Robert Pluim <rpluim@gmail.com>
Cc: 40665@debbugs.gnu.org
Subject: bug#40665: 28.0.50; tls hang on local ssl
Date: Wed, 22 Apr 2020 15:16:12 +0000 (UTC)	[thread overview]
Message-ID: <86wo67im9w.fsf@mail.3qin.us> (raw)
In-Reply-To: <m2blnjvf3r.fsf@gmail.com>


Robert Pluim writes:

>     Derek> I don't quite understand the wait_proc business. The idea of the patch
>     Derek> is to detect that out of all the fds that are going to be selected, how
>     Derek> many are gnutls managed and are ready from the gnutls buffer? If the
>     Derek> answer is positive, we skip the select and pretend the select return
>     Derek> those fds only. I think this is safe; because it is one of the possible
>     Derek> and legal return of the select, wait_proc or not.
>
> The reason for checking wait_proc is to allow 'accept-process-output'
> to specify that emacs should return only when there is data for that
> specific process, with your patch it can return if there is any data
> in the TLS buffers for any connection, but none for wait_proc. That
> would make 'accept-process-output' return earlier than expected, or
> even return for the case where the timeout is infinite.
>
> A quick survey of the emacs sources shows almost every call to
> 'accept-process-output' passes in wait_proc, so I think that your
> change as it stands is too risky. With a check for wait_proc it might
> be OK.
>
My counter argument is if we really only care about some of the the fds
but not all the fds, the proper way is to let select know by passing in
the proper narrower set of fds, maybe the code is already this way? It is very
complicated so I am not sure. I am checking only those fds that are both
1, gnutls managed, and the 2 set in the input for readfds for the
select, so I believe it is the right thing.

>     Derek> Another way is to still do a zero timeout select, and merge the gnutls
>     Derek> ready set with the select ready set. It is more intrusive but probably
>     Derek> closer to the original intent of the code. I can write the path that way
>     Derek> if you want.
>
> I donʼt think we always do a zero timeout select. This sounds even
> riskier.

I am proposing doing a zero timeout select ONLY if the gnutls buffer
check already flags some of the channels. This way we can also select those
FDs that are not gnutls managed, but already ready to read at the same
moment. It is closer to the origin intention of the select, I
believe. If the gnutls buffer check does not flag anything of cause we do
the select with timeout exactly as before. My current patch may leave
out some ready fd unchecked until the next round.

Derek





  reply	other threads:[~2020-04-22 15:16 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 14:06 bug#40665: 28.0.50; tls hang on local ssl Derek Zhou
2020-04-16 16:22 ` Robert Pluim
2020-04-16 18:22   ` Derek Zhou
2020-04-16 20:47     ` Derek Zhou
2020-04-16 23:01       ` Derek Zhou
2020-04-17 18:41         ` Derek Zhou
2020-04-18  2:44           ` Derek Zhou
2020-04-19 14:34             ` Robert Pluim
2020-04-19 15:34               ` Derek Zhou
2020-04-19 16:12                 ` Robert Pluim
2020-04-21  0:27                   ` Derek Zhou
2020-04-21  1:41                     ` Derek Zhou
2020-04-21  7:39                       ` Robert Pluim
2020-04-21 13:37                         ` Derek Zhou
2020-04-21 14:03                           ` Robert Pluim
2020-04-21 14:45                             ` Derek Zhou
2020-04-21 15:02                               ` Derek Zhou
2020-04-21 15:04                               ` Robert Pluim
2020-04-21 20:20                                 ` Derek Zhou
2020-04-21 22:20                                   ` Derek Zhou
2020-04-21 22:29                                     ` Derek Zhou
2020-04-22  8:32                                       ` Robert Pluim
2020-04-22 12:25                                         ` Derek Zhou
2020-04-22 13:12                                           ` Robert Pluim
2020-04-22 15:16                                             ` Derek Zhou [this message]
2020-04-22 16:14                                               ` Robert Pluim
2020-04-22 16:57                                                 ` Derek Zhou
2020-04-23  2:20                                                 ` Derek Zhou
2020-04-24 14:23                                                   ` Derek Zhou via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-24 14:29                                                     ` Robert Pluim
2020-05-07 19:08                                                       ` Derek Zhou via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-07-31 23:22                                                   ` Derek Zhou via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-02  5:34                                                   ` Lars Ingebrigtsen
2020-08-03  5:58                                                     ` Lars Ingebrigtsen
2020-08-03  9:44                                                       ` Robert Pluim
2020-08-03 13:57                                                         ` Derek Zhou via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-03 16:03                                                           ` Robert Pluim
2020-08-04  8:42                                                           ` Lars Ingebrigtsen
2020-08-04 19:28                                                             ` Derek Zhou via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-04 19:45                                                               ` Lars Ingebrigtsen
2020-08-03 13:36                                                       ` Derek Zhou via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-04-17  8:35     ` Robert Pluim
2020-04-18  2:46       ` Derek Zhou

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=86wo67im9w.fsf@mail.3qin.us \
    --to=derek@3qin.us \
    --cc=40665@debbugs.gnu.org \
    --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 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.