From unknown Sat Jun 14 03:51:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11273: 24.0.94; quitting gdb Resent-From: Sam Steingold Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Apr 2012 18:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 11273@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Reply-To: sds@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.133477342110815 (code B ref -1); Wed, 18 Apr 2012 18:24:01 +0000 Received: (at submit) by debbugs.gnu.org; 18 Apr 2012 18:23:41 +0000 Received: from localhost ([127.0.0.1]:40206 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKZXU-0002oJ-8u for submit@debbugs.gnu.org; Wed, 18 Apr 2012 14:23:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43001) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKZXO-0002o4-BF for submit@debbugs.gnu.org; Wed, 18 Apr 2012 14:23:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKZWz-00065q-Ly for submit@debbugs.gnu.org; Wed, 18 Apr 2012 14:23:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, URIBL_BLACK autolearn=ham version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:37801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKZWz-00065i-G9 for submit@debbugs.gnu.org; Wed, 18 Apr 2012 14:23:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKZWu-0003AJ-7N for bug-gnu-emacs@gnu.org; Wed, 18 Apr 2012 14:23:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKZWo-00064I-RJ for bug-gnu-emacs@gnu.org; Wed, 18 Apr 2012 14:22:59 -0400 Received: from mail-qa0-f48.google.com ([209.85.216.48]:59974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKZWh-0005qp-4K; Wed, 18 Apr 2012 14:22:47 -0400 Received: by qam2 with SMTP id 2so709440qam.0 for ; Wed, 18 Apr 2012 11:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:user-agent:return-receipt-to:reply-to :x-attribution:x-disclaimer:date:message-id:mime-version :content-type; bh=71QRcH7SWjuyDFU2ULAjpzwqpZjTYKTsKhNg0jIdX5Y=; b=0U6n/D5zVXvkBpe348DrNj8+Czb/efFv2fB4gq+cyOPC9t2aYHjC3bUBcAkY7/qgHe khuOyE/u1LgM0v94stojh0c54+RVYFHTTodC/waFjJ9OxPfkTYDW75yRROH7RvXyyzkP PWcN4NmsRc5mQU+JKgLpffmcfrAx1OxCYkBwsBwaLyHDs/HESmAGuPknsBbU7rydH0xc epWPGB6HZSvtZC96NGnSGpl4szvUU/tbkjxvScsccvhjik3FgXEhSatdH2syYsIPqNT8 mBDjAwUeCWyVkkAaVqxvJtrPv+I50RkGC2pFeqo5KWwztW0xzyIM1+iXBRl9FRrVh1m9 aVqg== Received: by 10.224.187.210 with SMTP id cx18mr5147805qab.45.1334773364926; Wed, 18 Apr 2012 11:22:44 -0700 (PDT) Received: from t520sds ([74.113.160.197]) by mx.google.com with ESMTPS id z3sm12758457qao.9.2012.04.18.11.22.43 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Apr 2012 11:22:44 -0700 (PDT) From: Sam Steingold User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. Date: Wed, 18 Apr 2012 14:22:42 -0400 Message-ID: <87y5ps99xp.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -4.4 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.4 (----) I start gdb on an interactive process (clisp) which I then exit. Now, I quit gdb too, but I am still left with a bunch of gdb windows and emacs running at 100% cpu because (process-status "gdb-inferior") => run even though it actually does not run (according to ps). (delete-process "gdb-inferior") fixes that, but this should not be necessary. 1. BUG: even though the gdb-inferior process is not running, it is reported as running and emacs takes 100% cpu. 2. RFE: command gud-quit which would - delete all gud processes - quit-window all gud windows In GNU Emacs 24.0.94.5 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars) of 2012-03-29 on t520sds Windowing system distributor `The X.Org Foundation', version 11.0.11004000 Configured using: `configure '--with-wide-int'' -- Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000 http://www.childpsy.net/ http://openvotingconsortium.org http://memri.org http://jihadwatch.org http://dhimmi.com http://ffii.org What's the difference between Apathy & Ignorance? -I don't know and don't care! From unknown Sat Jun 14 03:51:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11273: 24.0.94; quitting gdb Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Apr 2012 08:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: sds@gnu.org Cc: 11273@debbugs.gnu.org Received: via spool by 11273-submit@debbugs.gnu.org id=B11273.133482410630306 (code B ref 11273); Thu, 19 Apr 2012 08:29:02 +0000 Received: (at 11273) by debbugs.gnu.org; 19 Apr 2012 08:28:26 +0000 Received: from localhost ([127.0.0.1]:40839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKmj0-0007si-Tb for submit@debbugs.gnu.org; Thu, 19 Apr 2012 04:28:26 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:47370 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKmiv-0007sR-2r for 11273@debbugs.gnu.org; Thu, 19 Apr 2012 04:28:21 -0400 Received: from [155.69.17.55] (port=47293 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SKmib-0003wk-7d; Thu, 19 Apr 2012 04:27:57 -0400 From: Chong Yidong References: <87y5ps99xp.fsf@gnu.org> Date: Thu, 19 Apr 2012 16:27:49 +0800 In-Reply-To: <87y5ps99xp.fsf@gnu.org> (Sam Steingold's message of "Wed, 18 Apr 2012 14:22:42 -0400") Message-ID: <87mx68yvlm.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Sam Steingold writes: > I start gdb on an interactive process (clisp) which I then exit. > Now, I quit gdb too, but I am still left with a bunch of gdb windows and > emacs running at 100% cpu because > (process-status "gdb-inferior") > => run > even though it actually does not run (according to ps). > (delete-process "gdb-inferior") fixes that, but this should not be > necessary. > > 1. BUG: even though the gdb-inferior process is not running, it is > reported as running and emacs takes 100% cpu. This seems to be a combination of two bugs in the process code. The situation is as follows: gdb-mi creates a pty process in the "gdb-inferior" buffer, and hooks that pty up to the main gdb process. The first bug is that it's necessary to explicitly call delete-process on pty processes. The gdb-mi code did not explicitly do this. Normally, when you kill a buffer Emacs offers to kill its processes, but this is ineffective for ptys, as the kill_buffer_processes() code calls kill-process, not delete-process. You can show this problem with the following code unrelated to gdb: M-: (start-process "foo" (current-buffer) nil) RET C-x k RET yes RET M-x list-processes RET Even though the pty's buffer is killed, and the user was prompted whether to kill the process and answered yes, the pty is still "running". I don't know whether we should fix this general bug for 24.1---Stefan, any opinion? In the meantime, I installed a workaround to explicitly call delete-process on the pty in the sentinel of the main gdb process. Here is the second bug. Uunder some circumstances, when the gdb process exits, the sentinel doesn't get run. You can see this by instrumenting the `gud-sentinel' function, starting `M-x gdb', issuing an "r" command, then "q". The sentinel is never called, even though list-processes confirms that the gdb process is now dead. I have no idea why this happens, but according to a debugging session it appears that the select() call in process.c:4457 always returns a value >=0, so that status_notify() is never called. Maybe this has to do with the presence of the gdb-inferior pty? From unknown Sat Jun 14 03:51:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11273: 24.0.94; quitting gdb Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Apr 2012 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Chong Yidong Cc: sds@gnu.org, 11273@debbugs.gnu.org Received: via spool by 11273-submit@debbugs.gnu.org id=B11273.133485226612741 (code B ref 11273); Thu, 19 Apr 2012 16:18:02 +0000 Received: (at 11273) by debbugs.gnu.org; 19 Apr 2012 16:17:46 +0000 Received: from localhost ([127.0.0.1]:42021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKu3G-0003JR-CO for submit@debbugs.gnu.org; Thu, 19 Apr 2012 12:17:46 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:58776 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKu3E-0003JL-TI for 11273@debbugs.gnu.org; Thu, 19 Apr 2012 12:17:45 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1SKu2s-0005Uq-Pu; Thu, 19 Apr 2012 12:17:22 -0400 From: Glenn Morris References: <87y5ps99xp.fsf@gnu.org> <87mx68yvlm.fsf@gnu.org> X-Spook: AVIP 2600 Magazine ANDVT ASPIC world domination NASA X-Ran: rOQ6D!(Yaz#YQz1Q%k.8Wmq.An~As_.+3gwq7.(\FlsuJngio;Q8mqb?zM;Xy>A\Zx&tWh X-Hue: white X-Attribution: GM Date: Thu, 19 Apr 2012 12:17:22 -0400 In-Reply-To: <87mx68yvlm.fsf@gnu.org> (Chong Yidong's message of "Thu, 19 Apr 2012 16:27:49 +0800") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Chong Yidong wrote: > In the meantime, I installed a workaround to explicitly call > delete-process on the pty in the sentinel of the main gdb process. Maybe you fixed bug#4437 then? From unknown Sat Jun 14 03:51:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11273: 24.0.94; quitting gdb Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Apr 2012 16:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: sds@gnu.org, 11273@debbugs.gnu.org Received: via spool by 11273-submit@debbugs.gnu.org id=B11273.133485410015836 (code B ref 11273); Thu, 19 Apr 2012 16:49:02 +0000 Received: (at 11273) by debbugs.gnu.org; 19 Apr 2012 16:48:20 +0000 Received: from localhost ([127.0.0.1]:42072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKuWm-00047I-Hl for submit@debbugs.gnu.org; Thu, 19 Apr 2012 12:48:20 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:59436 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKuWh-000475-SE for 11273@debbugs.gnu.org; Thu, 19 Apr 2012 12:48:16 -0400 Received: from bb116-14-12-6.singnet.com.sg ([116.14.12.6]:35328 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SKuWL-0003sK-UZ; Thu, 19 Apr 2012 12:47:50 -0400 From: Chong Yidong References: <87y5ps99xp.fsf@gnu.org> <87mx68yvlm.fsf@gnu.org> Date: Fri, 20 Apr 2012 00:47:41 +0800 In-Reply-To: (Glenn Morris's message of "Thu, 19 Apr 2012 12:17:22 -0400") Message-ID: <87k41bhdn6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Glenn Morris writes: > Chong Yidong wrote: > >> In the meantime, I installed a workaround to explicitly call >> delete-process on the pty in the sentinel of the main gdb process. > > Maybe you fixed bug#4437 then? Aha, looks like the situation is this: In Bug#4437, Nick Roberts proposed a patch to process.c to avoid sending a SIGCHLD to itself when it receives an EIO errno. However, he noted that this means that status_notify isn't called from wait_reading_process_output because this call is conditioned on select which returns a positive value (presumably because the pty's file descriptor hasn't been cleared). which is the problem I noticed. Nick didn't commit the patch at the time. In Bug#10933, Troels Nielsen independently proposed the same patch, which was committed by Stefan on 2012-03-23. The question is what to do about the problem. I didn't test this, but it may be that the patch causes ALL process sentinels to be blocked while the gdb process is running, which is kinda unacceptable. From unknown Sat Jun 14 03:51:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11273: 24.0.94; quitting gdb Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Apr 2012 17:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Chong Yidong Cc: sds@gnu.org, 11273@debbugs.gnu.org Received: via spool by 11273-submit@debbugs.gnu.org id=B11273.133485641319336 (code B ref 11273); Thu, 19 Apr 2012 17:27:02 +0000 Received: (at 11273) by debbugs.gnu.org; 19 Apr 2012 17:26:53 +0000 Received: from localhost ([127.0.0.1]:42112 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKv89-00051p-Io for submit@debbugs.gnu.org; Thu, 19 Apr 2012 13:26:53 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:60167 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKv87-00051h-Bt for 11273@debbugs.gnu.org; Thu, 19 Apr 2012 13:26:51 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1SKv7l-00012o-3u; Thu, 19 Apr 2012 13:26:29 -0400 From: Glenn Morris References: <87y5ps99xp.fsf@gnu.org> <87mx68yvlm.fsf@gnu.org> <87k41bhdn6.fsf@gnu.org> X-Spook: morse data haven Janet Reno pipeline ANDVT e-bomb SHA X-Ran: {a{xiyL)TX-OQ^WLb-pO$ym:_~"ub`"m;D#g>TeO`2}6]z$DdK[lt&1~$U9cbVI&aub6%2 X-Hue: cyan X-Attribution: GM Date: Thu, 19 Apr 2012 13:26:29 -0400 In-Reply-To: <87k41bhdn6.fsf@gnu.org> (Chong Yidong's message of "Fri, 20 Apr 2012 00:47:41 +0800") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Also, I don't know if it has any relevance here, but just thought I'd mention that I previously reverted some gdb-related process.c change that was causing general problems - bug#9839. From unknown Sat Jun 14 03:51:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11273: 24.0.94; quitting gdb Resent-From: Troels Nielsen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Apr 2012 18:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Chong Yidong Cc: Glenn Morris , sds@gnu.org, 11273@debbugs.gnu.org Received: via spool by 11273-submit@debbugs.gnu.org id=B11273.133485980024541 (code B ref 11273); Thu, 19 Apr 2012 18:24:01 +0000 Received: (at 11273) by debbugs.gnu.org; 19 Apr 2012 18:23:20 +0000 Received: from localhost ([127.0.0.1]:42206 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKw0l-0006Nl-Lf for submit@debbugs.gnu.org; Thu, 19 Apr 2012 14:23:20 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:62708) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKw0j-0006NZ-Kr for 11273@debbugs.gnu.org; Thu, 19 Apr 2012 14:23:18 -0400 Received: by wgbdq11 with SMTP id dq11so9273632wgb.15 for <11273@debbugs.gnu.org>; Thu, 19 Apr 2012 11:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:content-type:content-transfer-encoding:message-id:date :from:to:cc:subject:in-reply-to:references:x-mailer; bh=g1VU3MmkUj972EAoG0fs6b0gI5Z2YoxddaYOJ/AKa1o=; b=ORnQLQ5hqpgk8c8wfv3ba9bbYZ25boFRH6OhUVwXoJnYQsTswrkKT9Rnc9f/0Bw235 e4DV1Y6XJLMdERkXLrKpw4u37l1RtlRtOjRmZ/iXd5h5XkLQ/4AvqD/2kGqcLkAUc7d6 EkeoZzlRNdDzfc//lC5W2mJeH2mHxrNyhfmwOa2oqBFBbGQZBVtB2/3Ws+xrSXNcY9qK Upm9SOyIjn0jcFjy+Gyp/z0HVYJG2UekTwmIivjCNP78GPrRK+0oTYYGmXJ/zjlhy5y0 sLAmCPftl0U75iX5gMky2g8eQ7MrX02TU84fqtABBNr0E6ONeCh8ZCH7bVvmzia++NUv gWLg== Received: by 10.180.96.228 with SMTP id dv4mr647807wib.14.1334859771700; Thu, 19 Apr 2012 11:22:51 -0700 (PDT) Received: from polaris.localdomain (4709ds3-oebr.0.fullrate.dk. [90.184.164.5]) by mx.google.com with ESMTPS id u9sm43905429wix.0.2012.04.19.11.22.49 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Apr 2012 11:22:50 -0700 (PDT) Received: by polaris.localdomain (Postfix, from userid 1000) id 00774242275; Thu, 19 Apr 2012 20:22:56 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <20368.22528.385744.874377@gargle.gargle.HOWL> Date: Thu, 19 Apr 2012 20:22:56 +0200 From: Troels Nielsen In-Reply-To: <87k41bhdn6.fsf@gnu.org> References: <87y5ps99xp.fsf@gnu.org> <87mx68yvlm.fsf@gnu.org> <87k41bhdn6.fsf@gnu.org> X-Mailer: VM 8.2.0b under 24.1.50.11 (x86_64-unknown-linux-gnu) X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Chong Yidong writes: > Glenn Morris writes: > > > Chong Yidong wrote: > > > >> In the meantime, I installed a workaround to explicitly call > >> delete-process on the pty in the sentinel of the main gdb process. > > > > Maybe you fixed bug#4437 then? > > Aha, looks like the situation is this: > > In Bug#4437, Nick Roberts proposed a patch to process.c to avoid sending > a SIGCHLD to itself when it receives an EIO errno. However, he noted > that this > > means that status_notify isn't called from > wait_reading_process_output because this call is conditioned on > select which returns a positive value (presumably because the pty's > file descriptor hasn't been cleared). > > which is the problem I noticed. Nick didn't commit the patch at the > time. > > In Bug#10933, Troels Nielsen independently proposed the same patch, > which was committed by Stefan on 2012-03-23. > > The question is what to do about the problem. I didn't test this, but > it may be that the patch causes ALL process sentinels to be blocked > while the gdb process is running, which is kinda unacceptable. Hi Chong I've looked into the issue more deeply and I think my suggested patch is most certainly wrong. The PTY somehow continously will tell select it has data available, but when emacs_read tries to read it nothing but an error and errno=IO is returned. I will look into a different way of solving #10933, but I think for now my changes should be removed. Regards Troels From unknown Sat Jun 14 03:51:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11273: 24.0.94; quitting gdb Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Apr 2012 02:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Troels Nielsen Cc: Glenn Morris , sds@gnu.org, 11273@debbugs.gnu.org Received: via spool by 11273-submit@debbugs.gnu.org id=B11273.13348902898250 (code B ref 11273); Fri, 20 Apr 2012 02:52:01 +0000 Received: (at 11273) by debbugs.gnu.org; 20 Apr 2012 02:51:29 +0000 Received: from localhost ([127.0.0.1]:43059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SL3wW-000290-ME for submit@debbugs.gnu.org; Thu, 19 Apr 2012 22:51:29 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:41922 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SL3wU-00028r-Az for 11273@debbugs.gnu.org; Thu, 19 Apr 2012 22:51:27 -0400 Received: from bb116-14-12-6.singnet.com.sg ([116.14.12.6]:35603 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SL3w4-0005cy-IL; Thu, 19 Apr 2012 22:51:01 -0400 From: Chong Yidong References: <87y5ps99xp.fsf@gnu.org> <87mx68yvlm.fsf@gnu.org> <87k41bhdn6.fsf@gnu.org> <20368.22528.385744.874377@gargle.gargle.HOWL> Date: Fri, 20 Apr 2012 10:50:52 +0800 In-Reply-To: <20368.22528.385744.874377@gargle.gargle.HOWL> (Troels Nielsen's message of "Thu, 19 Apr 2012 20:22:56 +0200") Message-ID: <87397zw1yr.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Troels Nielsen writes: > I've looked into the issue more deeply and I think my suggested patch > is most certainly wrong. The PTY somehow continously will tell select > it has data available, but when emacs_read tries to read it nothing > but an error and errno=IO is returned. Yes, apparently we have no choice but to stop reading from the pty on receiving EIO, otherwise Emacs will spin trying to read from it (that's probably the reason for the gdb-mi causing 100% CPU someone reported). I propose the following patch. On getting EIO, Emacs sets up the pty process object so that it runs its sentinel, with the `failed' process status. Then gdb-mi applies a sentinel to the inferior-io pty, and that sentinel is responsible for allocating a new pty and hooking it to gdb. If there are no objections, I will commit this shortly. === modified file 'lisp/progmodes/gdb-mi.el' *** lisp/progmodes/gdb-mi.el 2012-04-19 08:09:30 +0000 --- lisp/progmodes/gdb-mi.el 2012-04-20 02:48:54 +0000 *************** *** 817,827 **** nil 'local) (local-set-key "\C-i" 'completion-at-point) - ;; FIXME: Under some circumstances, `gud-sentinel' apparently does - ;; not get called when the gdb process is killed (Bug#11273). - (add-hook 'post-command-hook 'gdb-inferior-io--maybe-delete-pty - nil t) - (setq gdb-first-prompt t) (setq gud-running nil) --- 817,822 ---- *************** *** 863,877 **** (gdb-get-buffer-create 'gdb-inferior-io) (gdb-clear-inferior-io) ! (set-process-filter (get-process "gdb-inferior") 'gdb-inferior-filter) ! (gdb-input ! ;; Needs GDB 6.4 onwards ! (concat "-inferior-tty-set " ! (or ! ;; The process can run on a remote host. ! (process-get (get-process "gdb-inferior") 'remote-tty) ! (process-tty-name (get-process "gdb-inferior")))) ! 'ignore) (if (eq window-system 'w32) (gdb-input "-gdb-set new-console off" 'ignore)) (gdb-input "-gdb-set height 0" 'ignore) --- 858,865 ---- (gdb-get-buffer-create 'gdb-inferior-io) (gdb-clear-inferior-io) ! (gdb-inferior-io--init-proc (get-process "gdb-inferior")) ! (if (eq window-system 'w32) (gdb-input "-gdb-set new-console off" 'ignore)) (gdb-input "-gdb-set height 0" 'ignore) *************** *** 1522,1527 **** --- 1510,1537 ---- inf-pty (delete-process inf-pty)))) + (defun gdb-inferior-io--init-proc (proc) + ;; Set up inferior I/O. Needs GDB 6.4 onwards. + (set-process-filter proc 'gdb-inferior-filter) + (set-process-sentinel proc 'gdb-inferior-io-sentinel) + (gdb-input + (concat "-inferior-tty-set " + ;; The process can run on a remote host. + (or (process-get proc 'remote-tty) + (process-tty-name proc))) + 'ignore)) + + (defun gdb-inferior-io-sentinel (proc str) + (when (eq (process-status proc) 'failed) + ;; When the debugged process exits, Emacs gets an EIO on read from + ;; the pty. We must remove the pty now (otherwise select() keeps + ;; triggering on this pty due to the EIO, and Emacs loops trying + ;; to read from it), and set up a new one. + (let ((buffer (process-buffer proc))) + ;; `comint-exec' deletes the original process as a side effect. + (comint-exec buffer "gdb-inferior" nil nil nil) + (gdb-inferior-io--init-proc (get-buffer-process buffer))))) + (defconst gdb-frame-parameters '((height . 14) (width . 80) (unsplittable . t) === modified file 'src/process.c' *** src/process.c 2012-04-18 07:21:18 +0000 --- src/process.c 2012-04-20 02:30:22 +0000 *************** *** 4893,4908 **** It can't hurt. */ else if (nread == -1 && errno == EIO) { ! /* Don't do anything if only a pty, with no associated ! process (bug#10933). */ ! if (XPROCESS (proc)->pid != -2) { ! /* Clear the descriptor now, so we only raise the signal ! once. */ ! FD_CLR (channel, &input_wait_mask); ! FD_CLR (channel, &non_keyboard_wait_mask); ! ! kill (getpid (), SIGCHLD); ! } } #endif /* HAVE_PTYS */ /* If we can detect process termination, don't consider the --- 4893,4915 ---- It can't hurt. */ else if (nread == -1 && errno == EIO) { ! struct Lisp_Process *p = XPROCESS (proc); ! ! /* Clear the descriptor now, so we only raise the ! signal once. */ ! FD_CLR (channel, &input_wait_mask); ! FD_CLR (channel, &non_keyboard_wait_mask); ! ! if (p->pid == -2) ! { ! /* If the EIO occurs on a pty, sigchld_handler's ! wait3 will not find the process object to ! mark for deletion. Do that here. */ ! p->tick = ++process_tick; ! p->status = Qfailed; ! } ! else ! kill (getpid (), SIGCHLD); } #endif /* HAVE_PTYS */ /* If we can detect process termination, don't consider the From unknown Sat Jun 14 03:51:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11273: 24.0.94; quitting gdb Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Apr 2012 06:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Troels Nielsen Cc: Glenn Morris , sds@gnu.org, 11273@debbugs.gnu.org Received: via spool by 11273-submit@debbugs.gnu.org id=B11273.13349041721451 (code B ref 11273); Fri, 20 Apr 2012 06:43:02 +0000 Received: (at 11273) by debbugs.gnu.org; 20 Apr 2012 06:42:52 +0000 Received: from localhost ([127.0.0.1]:43300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SL7YR-0000NL-Ao for submit@debbugs.gnu.org; Fri, 20 Apr 2012 02:42:52 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:48065 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SL7YP-0000NF-Oe for 11273@debbugs.gnu.org; Fri, 20 Apr 2012 02:42:50 -0400 Received: from [155.69.18.143] (port=50271 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SL7Xz-0005cS-SI; Fri, 20 Apr 2012 02:42:24 -0400 From: Chong Yidong References: <87y5ps99xp.fsf@gnu.org> <87mx68yvlm.fsf@gnu.org> <87k41bhdn6.fsf@gnu.org> <20368.22528.385744.874377@gargle.gargle.HOWL> <87397zw1yr.fsf@gnu.org> Date: Fri, 20 Apr 2012 14:42:16 +0800 In-Reply-To: <87397zw1yr.fsf@gnu.org> (Chong Yidong's message of "Fri, 20 Apr 2012 10:50:52 +0800") Message-ID: <87ehriykdz.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Chong Yidong writes: > I propose the following patch. On getting EIO, Emacs sets up the pty > process object so that it runs its sentinel, with the `failed' process > status. Then gdb-mi applies a sentinel to the inferior-io pty, and that > sentinel is responsible for allocating a new pty and hooking it to gdb. > > If there are no objections, I will commit this shortly. Committed to emacs-24 branch. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 20 02:51:16 2012 Received: (at control) by debbugs.gnu.org; 20 Apr 2012 06:51:16 +0000 Received: from localhost ([127.0.0.1]:43314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SL7gZ-0001NW-G1 for submit@debbugs.gnu.org; Fri, 20 Apr 2012 02:51:16 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:48280 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SL7gW-0001NP-U6 for control@debbugs.gnu.org; Fri, 20 Apr 2012 02:51:13 -0400 Received: from [155.69.18.143] (port=50284 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SL7g8-0000BQ-Mm for control@debbugs.gnu.org; Fri, 20 Apr 2012 02:50:49 -0400 From: Chong Yidong To: control@debbugs.gnu.org Subject: close 11273 Date: Fri, 20 Apr 2012 14:50:42 +0800 Message-ID: <87zka6nbgd.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) close 11273 thanks