From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48118: 27.1; 28; Only first process receives output with multiple running processes Date: Fri, 30 Apr 2021 18:58:06 +0300 Message-ID: <83bl9vbw8h.fsf@gnu.org> References: <64c194f9-b984-adaa-d5fd-86aa3ed3833a@daniel-mendler.de> <83wnsjc0vd.fsf@gnu.org> <83tunnc0hz.fsf@gnu.org> <83pmybc03l.fsf@gnu.org> <83o8dvbyyz.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37332"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48118@debbugs.gnu.org To: Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 30 17:59:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lcVXp-0009bl-Hg for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Apr 2021 17:59:09 +0200 Original-Received: from localhost ([::1]:49228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcVXo-0006Ox-FS for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Apr 2021 11:59:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcVXi-0006Ok-Uy for bug-gnu-emacs@gnu.org; Fri, 30 Apr 2021 11:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48099) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcVXi-00047e-MV for bug-gnu-emacs@gnu.org; Fri, 30 Apr 2021 11:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lcVXi-00079F-Hu for bug-gnu-emacs@gnu.org; Fri, 30 Apr 2021 11:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Apr 2021 15:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48118 X-GNU-PR-Package: emacs Original-Received: via spool by 48118-submit@debbugs.gnu.org id=B48118.161979830427430 (code B ref 48118); Fri, 30 Apr 2021 15:59:02 +0000 Original-Received: (at 48118) by debbugs.gnu.org; 30 Apr 2021 15:58:24 +0000 Original-Received: from localhost ([127.0.0.1]:59645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcVX5-00078M-J8 for submit@debbugs.gnu.org; Fri, 30 Apr 2021 11:58:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43130) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcVX4-000786-F3 for 48118@debbugs.gnu.org; Fri, 30 Apr 2021 11:58:22 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:50072) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcVWy-0003r3-HC; Fri, 30 Apr 2021 11:58:16 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2799 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lcVWw-0003Lm-1u; Fri, 30 Apr 2021 11:58:14 -0400 In-Reply-To: (message from Daniel Mendler on Fri, 30 Apr 2021 17:39:35 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205272 Archived-At: > Cc: 48118@debbugs.gnu.org > From: Daniel Mendler > Date: Fri, 30 Apr 2021 17:39:35 +0200 > > >> Which scenarios break? > > > > For example, if the filter function call accept-process-output. Or > > does anything else that changes output from which processes is or > > isn't available. > > Does this necessarily prevent scheduling? I interpret > `accept-process-output` as a function which prioritizes a process, but I > am unsure if this makes it impossible to implement additional scheduling. A call to accept-process-output prioritizes a process only if it explicitly requests output from that single process. Which is not necessarily true in all cases. > > What does this mean, exactly? Which quantity should be doled in a > > round-robin fashion? bytes read from the processes? something else? > > > > If the bytes read, then how do you suggest to handle two processes > > which produce output at very different rates? > > For example bytes read or time spent to handle a process (time spent in > the filter function?). Bytes read has a problem when processes produce output a very different rates. Time spent to handle may (and usually does) mean the filter function does something expensive, it doesn't necessarily tell anything about the output from the subprocess. > When I stumbled over this issue, it astonished me that Emacs > does not seem to do any scheduling at all and handles only a single > process. If you read the code, you will see this isn't what happens. What happens is that Emacs reads a chunk of output from the first process it sees ready, then it goes back and re-checks which processes are ready -- and in your scenario I think it again sees that the first process is ready. > What is the reason for the current behavior? Is it predictability? If I > understand correctly, Emacs always reads from the first process. If data > arrives, Emacs does not read from the second processes at all. Only if > no data is available from the first process, the second process is > handled. Is it like this? In your scenario, yes. It depends on how large is the output produced by a process in one go. I suggest to read the code of wait_reading_process_output, it has some non-trivial logic in this department.