all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>,
	24201@debbugs.gnu.org, eggert@cs.ucla.edu
Subject: bug#24201: 25.1.50; TLS connections sometimes hang
Date: Thu, 04 Jul 2019 15:04:54 +0200	[thread overview]
Message-ID: <m3a7du7xxl.fsf@gnus.org> (raw)
In-Reply-To: <m3o92eyjzj.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 30 Jun 2019 21:02:40 +0200")

I've been poking more at this, and I think there really must be a bug
somewhere in accept-process-output.

With the following patch, connection never hangs:

diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index 2b3292b71b..cdb33a59f1 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -376,7 +376,7 @@ network-stream-get-response
 	(goto-char start)
 	(while (and (memq (process-status stream) '(open run))
 		    (not (re-search-forward end-of-command nil t)))
-	  (accept-process-output stream 0.05)
+	  (accept-process-output stream 0.05 nil t)
 	  (goto-char start))
 	;; Return the data we got back, or nil if the process died.
 	(unless (= start (point))

It's the JUST-THIS-ONE parameter: If that's non-nil, then
accept-process-output returns after the timeout...  and we get the data.

Now, tracing the logic in wait_reading_process_output is rather...
difficult.  It's an 800 line function with lots of inputs from
everywhere.  But I think this code looks suspicious:

	  if (NILP (wait_for_cell) && just_wait_proc >= 0
	      && timespec_valid_p (timer_delay)
	      && timespec_cmp (timer_delay, timeout) < 0)
	    {
	      if (!timespec_valid_p (now))
		now = current_timespec ();
	      struct timespec timeout_abs = timespec_add (now, timeout);
	      if (!timespec_valid_p (got_output_end_time)
		  || timespec_cmp (timeout_abs, got_output_end_time) < 0)
		got_output_end_time = timeout_abs;
	      timeout = timer_delay;
	    }
	  else
	    got_output_end_time = invalid_timespec ();

This is done only if JUST-THIS-ONE is set.

But...  the timeout stuff is implemented in a very convoluted manner,
with reuse of certain variables that makes what this is trying to
achieve rather opaque. 

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






  reply	other threads:[~2019-07-04 13:04 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11 13:20 bug#24201: 25.1.50; TLS connections sometimes hang Lars Ingebrigtsen
2016-08-15  2:35 ` Paul Eggert
2016-10-10 10:36   ` Eli Zaretskii
2016-10-10 10:54     ` Lars Ingebrigtsen
2016-10-10 11:23       ` Eli Zaretskii
2017-09-02 12:40         ` Eli Zaretskii
2017-09-02 13:04           ` Lars Ingebrigtsen
2017-09-02 14:21             ` Eli Zaretskii
2018-02-18 17:57               ` Lars Ingebrigtsen
2018-02-19 16:52                 ` Lars Ingebrigtsen
2018-02-19 17:56                   ` Paul Eggert
2018-02-19 18:16                     ` Lars Ingebrigtsen
2018-02-19 18:32                       ` Eli Zaretskii
2018-02-19 19:06                         ` Lars Ingebrigtsen
2018-02-19 19:57                           ` Eli Zaretskii
2018-02-19 20:39                             ` Lars Ingebrigtsen
2019-06-24 13:25                               ` Lars Ingebrigtsen
2019-06-24 19:20                                 ` Eli Zaretskii
2019-06-24 20:46                                   ` Lars Ingebrigtsen
2019-06-25 19:15                                     ` Lars Ingebrigtsen
2019-06-25 21:57                                       ` Lars Ingebrigtsen
2019-06-26 16:32                                         ` Eli Zaretskii
2019-06-27 10:34                                           ` Lars Ingebrigtsen
2019-06-27 13:25                                             ` Eli Zaretskii
2019-06-27 19:28                                               ` Lars Ingebrigtsen
2019-06-28  6:19                                                 ` Eli Zaretskii
2019-06-28  8:25                                                   ` Lars Ingebrigtsen
2019-06-28  8:34                                                     ` Eli Zaretskii
2019-06-28  9:55                                                       ` Lars Ingebrigtsen
2019-06-28 12:26                                                         ` Eli Zaretskii
2019-06-28 14:39                                             ` Basil L. Contovounesios
2019-06-28 14:50                                               ` Eli Zaretskii
2019-06-30 19:02                                                 ` Lars Ingebrigtsen
2019-07-04 13:04                                                   ` Lars Ingebrigtsen [this message]
2019-07-04 19:05                                                     ` Eli Zaretskii
2019-07-05 12:59                                                       ` Lars Ingebrigtsen
2019-07-05 18:03                                                         ` Eli Zaretskii
2019-07-06 12:16                                                           ` Lars Ingebrigtsen
2019-07-07 18:13                                                             ` Lars Ingebrigtsen
2019-07-07 18:18                                                               ` Eli Zaretskii
2019-07-08 16:38                                                                 ` Lars Ingebrigtsen
2020-08-03  6:00                                                                   ` Lars Ingebrigtsen
2019-07-05  8:21                                                     ` Eli Zaretskii
2019-07-05 13:13                                                       ` Lars Ingebrigtsen
2019-06-26 16:29                                       ` Eli Zaretskii
2018-02-19 18:37                       ` Andreas Schwab

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=m3a7du7xxl.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=24201@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.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.