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.devel Subject: Re: accept-process-output throws Date: Wed, 24 Nov 2021 14:38:09 +0200 Message-ID: <834k81afv2.fsf@gnu.org> References: <29A79E00-3117-4F18-BB4F-3ADD2DBB0806@gmail.com> <838rxe9quw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38227"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: JD Smith Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 24 13:40:52 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mprZy-0009go-4J for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Nov 2021 13:40:50 +0100 Original-Received: from localhost ([::1]:59610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mprZt-0006mZ-6y for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Nov 2021 07:40:45 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mprXQ-0005uK-OY for emacs-devel@gnu.org; Wed, 24 Nov 2021 07:38:14 -0500 Original-Received: from [2001:470:142:3::e] (port=55848 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mprXO-0004wS-J3; Wed, 24 Nov 2021 07:38:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=yY83UwG6VKoOjn4sX0CPXCR1DHsqAMrqMy8bwi88LoA=; b=UvDPVxarShVXKLtxSPi/ c1BirrO4iT9fb+kZD2oWHCB5pHBPi4K/66DyCCZaTD8vpQK8yfR8zw3I6DILrRUh6F0BLQg+Bhn0n qF2l124h1Aw4yQ5FpTplQs6OpmnqjVEb87Ujn14IQKxiPGCnnY+3LOmJ4gl/7R2qwHhmpvwWQ0wL0 mNVJctqkWcOyqPIlIxfuNnSpRY6SuMcpB8SBC5UYOip75PkviXP3N5hnhx7DjBKjUgewiMkMChIS+ aetwXb5ZICO4yJmtSVIquGnCFVj5OYR5qc2e4fuwL0UKCj3zUU5LS8vEmg9u/XhV+4jJyRNRAUt5a 1t81rNf26ZSYZQ==; Original-Received: from [87.69.77.57] (port=1412 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mprXN-0000o8-Ga; Wed, 24 Nov 2021 07:38:10 -0500 In-Reply-To: (message from JD Smith on Wed, 24 Nov 2021 00:14:06 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:279993 Archived-At: > From: JD Smith > Date: Wed, 24 Nov 2021 00:14:06 -0500 > Cc: emacs-devel@gnu.org > > > > > On Nov 23, 2021, at 10:25 PM, Eli Zaretskii wrote: > > > > Is this in "emacs -Q"? If so, how did you start the process, and what > > do you have in the process-filter and process-sentinel functions for > > this process? > > This is in a customized inferior python mode (a comint-derived mode), running iPython as the process. I discovered the issue with `python-shell-send-string-no-output', which adds its own pre-output-filter to accumulate and discard process output. The no-output commands are being sent to the process from a post-command hook which kicks off a timer (to gather completion and syntax data). The command results arrive promptly, but when the non-local exit occurs, they “escape" the pre-output filtering and show up in the buffer. When this occurs, it is always as a result of the non-local exit of `accept-process-output’. I’ve found the problem gets more severe when the PCH-launched timer's delay is very small (<0.1s), i.e. when commands are sent in quick succession while typing. > > I do not have an emacs -Q demo of this but can look at creating one with the stock python-shell-mode. In the meantime I’ve found that if I bind (inhibit-quit t), remove `with-local-quit' and specify a timeout in `accept-process-output' (to silence the warning about the blocking call), this entirely prevents the non-local exit. But this I feel is more of a workaround than a solution, and I still do not understand the original problem. In this kind of complicated situations, I usually find it much simpler and more efficient to run under GDB with a breakpoint on Fsignal and Fthrow. Then, when one of these breaks, examine the backtrace to find out which code exited non-locally.