Received: (at 33747) by debbugs.gnu.org; 14 Dec 2018 21:23:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 14 16:23:19 2018 Received: from localhost ([127.0.0.1]:48627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gXuvX-0002IW-Cj for submit <at> debbugs.gnu.org; Fri, 14 Dec 2018 16:23:19 -0500 Received: from metalevel.at ([78.46.218.83]:47014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <triska@HIDDEN>) id 1gXuvV-0002IN-KL for 33747 <at> debbugs.gnu.org; Fri, 14 Dec 2018 16:23:18 -0500 Received: by metalevel.at (Postfix, from userid 1000) id 32F89A122B; Fri, 14 Dec 2018 22:23:16 +0100 (CET) From: Markus Triska <triska@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#33747: 26.1; process-send-string exceeds max-specpdl-size References: <87bm5o2e3u.fsf@HIDDEN> <83o99oeyuz.fsf@HIDDEN> <874lbgeydc.fsf@HIDDEN> <83mup7g9yv.fsf@HIDDEN> Date: Fri, 14 Dec 2018 22:23:16 +0100 In-Reply-To: <83mup7g9yv.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 14 Dec 2018 21:54:48 +0200") Message-ID: <87mup7by63.fsf@HIDDEN> User-Agent: Emacs/24.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 33747 Cc: 33747 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: > stopping everything else, so waiting for input from any source makes > perfect sense to me. In this concrete case, I am looking for a way to make Emacs not wait for, or at least not process, input from a specific process while sending output to a different process. For the case I posted, I can alleviate the issue a bit if I set: (setq max-specpdl-size 5000) However, if I then use for example the following definition of send-to-target instead of the one I posted: (defun send-to-target (proc str) (if (process-live-p target) (process-send-string target str) (kill-process source))) then I get, for the receipe I posted: Lisp nesting exceeds =E2=80=98max-lisp-eval-depth=E2=80=99 This is unfortunate, because increasing this limit will eventually crash Emacs. The root cause is that process-send-string triggers the filter of the same process that caused the filter to be invoked. I find this unexpected, because the target process is different, and if possible, I would like a way do prevent this. Could you please consider adding a feature that prevents triggering the filter in such cases? Thank you and all the best! Markus
bug-gnu-emacs@HIDDEN
:bug#33747
; Package emacs
.
Full text available.Received: (at 33747) by debbugs.gnu.org; 14 Dec 2018 19:55:02 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 14 14:55:02 2018 Received: from localhost ([127.0.0.1]:48577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gXtY6-0008Qz-4b for submit <at> debbugs.gnu.org; Fri, 14 Dec 2018 14:55:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37873) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1gXtY4-0008QN-Qm for 33747 <at> debbugs.gnu.org; Fri, 14 Dec 2018 14:55:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <eliz@HIDDEN>) id 1gXtXv-0004dC-NB for 33747 <at> debbugs.gnu.org; Fri, 14 Dec 2018 14:54:55 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>) id 1gXtXv-0004d5-9U; Fri, 14 Dec 2018 14:54:51 -0500 Received: from [176.228.60.248] (port=4986 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from <eliz@HIDDEN>) id 1gXtXv-0004u4-1J; Fri, 14 Dec 2018 14:54:51 -0500 Date: Fri, 14 Dec 2018 21:54:48 +0200 Message-Id: <83mup7g9yv.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Markus Triska <triska@HIDDEN> In-reply-to: <874lbgeydc.fsf@HIDDEN> (message from Markus Triska on Fri, 14 Dec 2018 19:50:39 +0100) Subject: Re: bug#33747: 26.1; process-send-string exceeds max-specpdl-size References: <87bm5o2e3u.fsf@HIDDEN> <83o99oeyuz.fsf@HIDDEN> <874lbgeydc.fsf@HIDDEN> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 33747 Cc: 33747 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -6.0 (------) > From: Markus Triska <triska@HIDDEN> > Cc: 33747 <at> debbugs.gnu.org > Date: Fri, 14 Dec 2018 19:50:39 +0100 > > Eli Zaretskii <eliz@HIDDEN> writes: > > > AFAIK, process-send-string is a blocking function: it cannot return > > before the entire string was sent. > > Yes indeed. However, the C function send_process internally calls > wait_reading_process_output That's so as not to wedge the entire session. Communications with async subprocesses aren't supposed to stop everything in its tracks. > and this may again invoke the filter! In general, calling APIs that could take a long time from a process filter is not a very good idea, btw. Remember that process filters are run when Emacs is idle, so when you call an API that could take a long time, you make Emacs less responsive. And then there's the infinite recursion case that you hit. > What I find surprising is that this call of > wait_reading_process_output is not limited to the process whose > output queue is full, i.e., the one for which process-send-string > was actually invoked. I don't see any reason why it should only wait for output from the same process. Once again, this is Emacs's way to wait without stopping everything else, so waiting for input from any source makes perfect sense to me.
bug-gnu-emacs@HIDDEN
:bug#33747
; Package emacs
.
Full text available.Received: (at 33747) by debbugs.gnu.org; 14 Dec 2018 18:50:45 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 14 13:50:45 2018 Received: from localhost ([127.0.0.1]:48549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gXsXr-0006iZ-Hl for submit <at> debbugs.gnu.org; Fri, 14 Dec 2018 13:50:45 -0500 Received: from metalevel.at ([78.46.218.83]:45080) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <triska@HIDDEN>) id 1gXsXp-0006iR-Hi for 33747 <at> debbugs.gnu.org; Fri, 14 Dec 2018 13:50:42 -0500 Received: by metalevel.at (Postfix, from userid 1000) id D3828A122B; Fri, 14 Dec 2018 19:50:39 +0100 (CET) From: Markus Triska <triska@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#33747: 26.1; process-send-string exceeds max-specpdl-size References: <87bm5o2e3u.fsf@HIDDEN> <83o99oeyuz.fsf@HIDDEN> Date: Fri, 14 Dec 2018 19:50:39 +0100 Message-ID: <874lbgeydc.fsf@HIDDEN> User-Agent: Emacs/24.5 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 33747 Cc: 33747 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: > AFAIK, process-send-string is a blocking function: it cannot return > before the entire string was sent. Yes indeed. However, the C function send_process internally calls wait_reading_process_output, and this may again invoke the filter! What I find surprising is that this call of wait_reading_process_output is not limited to the process whose output queue is full, i.e., the one for which process-send-string was actually invoked. Would it work to limit it to that process, or could there be an alternative means to prevent reading from other processes in that case? It would be very useful in such situations where I simply want to send, and not read anything.
bug-gnu-emacs@HIDDEN
:bug#33747
; Package emacs
.
Full text available.Received: (at 33747) by debbugs.gnu.org; 14 Dec 2018 18:40:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 14 13:40:22 2018 Received: from localhost ([127.0.0.1]:48538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gXsNq-0006Se-32 for submit <at> debbugs.gnu.org; Fri, 14 Dec 2018 13:40:22 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1gXsNm-0006SL-Q9 for 33747 <at> debbugs.gnu.org; Fri, 14 Dec 2018 13:40:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <eliz@HIDDEN>) id 1gXsNd-0007wq-05 for 33747 <at> debbugs.gnu.org; Fri, 14 Dec 2018 13:40:13 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52649) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>) id 1gXsNc-0007wY-Le; Fri, 14 Dec 2018 13:40:08 -0500 Received: from [176.228.60.248] (port=4353 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from <eliz@HIDDEN>) id 1gXsNb-0000uV-7k; Fri, 14 Dec 2018 13:40:08 -0500 Date: Fri, 14 Dec 2018 20:40:04 +0200 Message-Id: <83o99oeyuz.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Markus Triska <triska@HIDDEN> In-reply-to: <87bm5o2e3u.fsf@HIDDEN> (message from Markus Triska on Fri, 14 Dec 2018 18:49:09 +0100) Subject: Re: bug#33747: 26.1; process-send-string exceeds max-specpdl-size References: <87bm5o2e3u.fsf@HIDDEN> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 33747 Cc: 33747 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -6.0 (------) > From: Markus Triska <triska@HIDDEN> > Date: Fri, 14 Dec 2018 18:49:09 +0100 > > The reason for this seems to be that process-send-string also builds up > frames for unwind-protect when it waits for input if the queue is full. > > However, in this concrete case, I would prefer to simply send (or queue) > the string and *not* wait for any input within the process filter. > > Is there a way to accomplish this? AFAIK, process-send-string is a blocking function: it cannot return before the entire string was sent.
bug-gnu-emacs@HIDDEN
:bug#33747
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 14 Dec 2018 17:50:55 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 14 12:50:55 2018 Received: from localhost ([127.0.0.1]:48511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gXrbz-0005BE-1Q for submit <at> debbugs.gnu.org; Fri, 14 Dec 2018 12:50:55 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <triska@HIDDEN>) id 1gXrbx-0005Aw-Ox for submit <at> debbugs.gnu.org; Fri, 14 Dec 2018 12:50:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1gXrbr-0005lD-Sk for submit <at> debbugs.gnu.org; Fri, 14 Dec 2018 12:50:48 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48519) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1gXrbr-0005l7-PB for submit <at> debbugs.gnu.org; Fri, 14 Dec 2018 12:50:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1gXrbq-0003rx-Nu for bug-gnu-emacs@HIDDEN; Fri, 14 Dec 2018 12:50:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1gXrbn-0005iy-II for bug-gnu-emacs@HIDDEN; Fri, 14 Dec 2018 12:50:46 -0500 Received: from metalevel.at ([78.46.218.83]:47814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1gXrbn-0005hm-AP for bug-gnu-emacs@HIDDEN; Fri, 14 Dec 2018 12:50:43 -0500 Received: from debian (localhost.localdomain [127.0.0.1]) by metalevel.at (Postfix) with ESMTP id 89014A0227 for <bug-gnu-emacs@HIDDEN>; Fri, 14 Dec 2018 18:50:39 +0100 (CET) Received: by debian (Postfix, from userid 1000) id 8F1ABE3ED4; Fri, 14 Dec 2018 18:49:09 +0100 (CET) From: Markus Triska <triska@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: 26.1; process-send-string exceeds max-specpdl-size Date: Fri, 14 Dec 2018 18:49:09 +0100 Message-ID: <87bm5o2e3u.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -6.0 (------) To reproduce this issue, please install the PostScript viewer Ghostscript ("gs"), and put the following forms in "pipe.el": (setq target (start-process "gs" nil "gs" "-g100x100") source (start-process "bash" nil "bash" "-c" "while true; do echo \ rand 2 31 exp div setgray 0 0 100 100 rectfill; done")) (set-process-filter source 'send-to-target) (defun send-to-target (proc str) (process-send-string target str)) When you then invoke Emacs via: $ emacs -Q pipe.el --eval '(eval-buffer)' you get almost instantly: error in process filter: Variable binding depth exceeds max-specpdl-size The reason for this seems to be that process-send-string also builds up frames for unwind-protect when it waits for input if the queue is full. However, in this concrete case, I would prefer to simply send (or queue) the string and *not* wait for any input within the process filter. Is there a way to accomplish this? Alternatively, would you please consider to provide such a mechanism? For example, when sending output to a process and the output queue of that process is full, would it be admissible or even preferable to wait only for input of that specific process, instead of also waiting for and handling input from other processes (as seems to be the case now)? Thank you and all the best! Markus In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2018-11-18 built on debian Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea Windowing system distributor 'The X.Org Foundation', version 11.0.11902000 System Description: Debian GNU/Linux 9.6 (stretch)
Markus Triska <triska@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#33747
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.