From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#23864: 25.1.50; Poor network responsivenes using open-network-stream Date: Mon, 4 Jul 2016 00:51:10 +0200 Message-ID: <577996DE.1070404@cs.ucla.edu> References: <22386.52993.297791.550073@ender.chrekh.se> <347fd7savc.fsf@fencepost.gnu.org> <5778D479.6020804@cs.ucla.edu> <22392.62757.717968.580284@ender.chrekh.se> <83oa6erbli.fsf@gnu.org> <22393.24431.818038.99105@ender.chrekh.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070404080804000804030305" X-Trace: ger.gmane.org 1467586348 2601 80.91.229.3 (3 Jul 2016 22:52:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Jul 2016 22:52:28 +0000 (UTC) Cc: 23864@debbugs.gnu.org To: Christer Ekholm , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 04 00:52:13 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bJqFJ-00057O-8W for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Jul 2016 00:52:13 +0200 Original-Received: from localhost ([::1]:44418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJqFI-00029E-C6 for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Jul 2016 18:52:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJqFC-00028w-PP for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2016 18:52:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJqF8-0001Y7-DT for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2016 18:52:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJqF8-0001Xw-9s for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2016 18:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bJqF8-0000F7-1T for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2016 18:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Jul 2016 22:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23864 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 23864-submit@debbugs.gnu.org id=B23864.1467586290893 (code B ref 23864); Sun, 03 Jul 2016 22:52:01 +0000 Original-Received: (at 23864) by debbugs.gnu.org; 3 Jul 2016 22:51:30 +0000 Original-Received: from localhost ([127.0.0.1]:36302 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJqEb-0000EL-Tp for submit@debbugs.gnu.org; Sun, 03 Jul 2016 18:51:30 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:59137) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJqEX-0000E4-WA for 23864@debbugs.gnu.org; Sun, 03 Jul 2016 18:51:28 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E884A16138F; Sun, 3 Jul 2016 15:51:19 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ouSPyI_Gb4Os; Sun, 3 Jul 2016 15:51:18 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D1D96161408; Sun, 3 Jul 2016 15:51:18 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id dhB1qMAj2mIv; Sun, 3 Jul 2016 15:51:18 -0700 (PDT) Original-Received: from [192.168.1.232] (unknown [2.224.134.180]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D91D816138F; Sun, 3 Jul 2016 15:51:17 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: <22393.24431.818038.99105@ender.chrekh.se> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:120376 Archived-At: This is a multi-part message in MIME format. --------------070404080804000804030305 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 07/03/2016 08:54 PM, Christer Ekholm wrote: > I have tested some more now, and a simple change from "else if" to > just "if" does help. > Thanks, that fixes part of the remaining bug, but I see another case where there's a problem: we need to test the minimum of the two end times against "now". I installed the attached further patch into 'master', which I hope puts this all to rest on 'master'. It is indeed a tricky area. --------------070404080804000804030305 Content-Type: text/x-patch; name="0001-Re-fix-open-network-stream-responsiveness.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Re-fix-open-network-stream-responsiveness.patch" >From 1c046c2158762d01d512957f1fcb4ec4d45028a8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 4 Jul 2016 00:46:57 +0200 Subject: [PATCH] Re-fix open-network-stream responsiveness Problem reported by Christer Ekholm (Bug#23864). * src/process.c (wait_reading_process_output): Further fix for typo introduced in 2015-07-06T02:19:13Z!eggert@cs.ucla.edu when wait == INFINITY and got_output_end_time is invalid. See: http://bugs.gnu.org/23864#20 --- src/process.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/process.c b/src/process.c index 376e872..bdbdefa 100644 --- a/src/process.c +++ b/src/process.c @@ -5269,20 +5269,22 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, haven't lowered our timeout due to timers or SIGIO and have waited a long amount of time due to repeated timers. */ - struct timespec cmp_time; - bool have_cmp_time = false; + struct timespec huge_timespec + = make_timespec (TYPE_MAXIMUM (time_t), 2 * TIMESPEC_RESOLUTION); + struct timespec cmp_time = huge_timespec; if (wait < TIMEOUT) break; - else if (wait == TIMEOUT) - cmp_time = end_time, have_cmp_time = true; - else if (!process_skipped && got_some_output > 0 - && (timeout.tv_sec > 0 || timeout.tv_nsec > 0)) + if (wait == TIMEOUT) + cmp_time = end_time; + if (!process_skipped && got_some_output > 0 + && (timeout.tv_sec > 0 || timeout.tv_nsec > 0)) { if (!timespec_valid_p (got_output_end_time)) break; - cmp_time = got_output_end_time, have_cmp_time = true; + if (timespec_cmp (got_output_end_time, cmp_time) < 0) + cmp_time = got_output_end_time; } - if (have_cmp_time) + if (timespec_cmp (cmp_time, huge_timespec) < 0) { now = current_timespec (); if (timespec_cmp (cmp_time, now) <= 0) -- 2.5.5 --------------070404080804000804030305--