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#66096: High CPU usage, basically runaway emacs with visit to bidi_cache_search on and off? Date: Tue, 19 Sep 2023 14:04:08 +0300 Message-ID: <834jjqe85z.fsf@gnu.org> References: <1808d5a1-3ee6-d675-3ad3-c6bcc2fe5e36@yk.rim.or.jp> 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="31912"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66096@debbugs.gnu.org, ishikawa@yk.rim.or.jp To: "ISHIKAWA,chiaki" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 19 13:05:32 2023 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 1qiYXr-000853-NW for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Sep 2023 13:05:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiYXR-0004Bw-30; Tue, 19 Sep 2023 07:05:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiYXI-00045M-FZ for bug-gnu-emacs@gnu.org; Tue, 19 Sep 2023 07:04:57 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiYXF-0002Bv-0A for bug-gnu-emacs@gnu.org; Tue, 19 Sep 2023 07:04:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qiYXN-000099-Ne for bug-gnu-emacs@gnu.org; Tue, 19 Sep 2023 07:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Sep 2023 11:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66096 X-GNU-PR-Package: emacs Original-Received: via spool by 66096-submit@debbugs.gnu.org id=B66096.1695121469517 (code B ref 66096); Tue, 19 Sep 2023 11:05:01 +0000 Original-Received: (at 66096) by debbugs.gnu.org; 19 Sep 2023 11:04:29 +0000 Original-Received: from localhost ([127.0.0.1]:55478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiYWr-00008H-4h for submit@debbugs.gnu.org; Tue, 19 Sep 2023 07:04:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiYWl-000081-Hs for 66096@debbugs.gnu.org; Tue, 19 Sep 2023 07:04:27 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiYWV-00022e-5b; Tue, 19 Sep 2023 07:04:07 -0400 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=7m+fKzMVdJljJ+Mf7ebAu3sLlrnyyJD/V1TK+HpHR9s=; b=bRJBFWGeCn5sKo0JaxJp XWrGgHdX2JQWlQ7Tz9LUkOVMAmMjJp7YKZDDQdcK8eldBqny95U+5zyknYPnIAgoGtHlLObYO+38N f38Jl9QT6sCx/FLq+KO5IrHqTFFsgrhBYWoodT18Zj2I0h+Nq7NbqAD6HXV0Vpul7NOkJ4aej3frU vd7u8gw/Y5+EoRi8VWxM2UAbbncyGr3OXe8wDXCAKuuqPnzVE8gJKljhIJ74mccJZZlfM6e+Y6Ezl qYJ2KY9lfToYOBiAC6HQwlytkDvPuyN3obVBa8m4dGArrg87oljYPZhJ5EbsJjNEHDHgtStXafVKa zy/bhr7bDaA5pg==; In-Reply-To: <1808d5a1-3ee6-d675-3ad3-c6bcc2fe5e36@yk.rim.or.jp> (ishikawa@yk.rim.or.jp) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270864 Archived-At: > Cc: "ishikawa, chiaki" > Date: Tue, 19 Sep 2023 13:12:33 +0900 > From: "ISHIKAWA,chiaki" > > High CPU usage, basically runaway emacs with visit to bidi_cache_search > on and off? > > Hi, > > Environment: > OS GNU/Debian Linux  X86_64 > Emacs version > GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, > cairo version 1.16.0) of 2023-08-01 > I compiled emacs using gcc. > > Has anyone seen emacs 29.1 spending CPU way too high, basically went > into an infinite loop of some sort, and could not be interrupted by > Control-G?  Basically it is in a runaway state. > I found that the stacktraces show that bidi_cache_search > and friends are visited now and then.  It is not the recursive blowup > probably since the stack depth is quite limited during my observation. > > > I have experienced this issue this morning.  Observing the stack > backtrace by monitoring the runaway emacs using gdb, I was surprised > to see many appearances of bidi_cache_search that were observed from > time to time while I do control-C to stop emacs and monitor > stacktrace, and the continue for a few seconds, and interrupt it again > with control-C.  After letting emacs run in this manner for about 5 > minutes, I had tp kill emacs.  I had to edit the file by a deadline and > could not continue debugging. :-( > > At the end is a single stacktrace with bidi_cache_search at the top. > I have seen this occurring multiple times. My hitting control-C to emacs > to enter gdb interaction means that the chance of hitting a particular > stacktrace pattern is small and seeing the same pattern multiple times > means that that pattern happens quite often. The backtrace shows we were resizing the mini-window, but it doesn't tell where and why we were looping. (The bidi_cache_search part is probably a red herring: that function is indeed called very frequently when Emacs performs display and layout calculations -- which is not surprising, since that's why the bidi cache exists: to provide cache hits whenever possible.) So it is important to have a file and the sequence of commands that trigger this. Please try to produce such a file and a recipe to reproduce the problem. Alternatively, you can use the technique described in etc/DEBUG for finding where Emacs loops, see there under "If the symptom of the bug is that Emacs fails to respond". I think even if you do discover where it loops, we'd need an example file to see why, though. > I have a dozen or so more different stacktraces during gdb monitoring. > If someone wants to see the log, I can post it. > What is the preferred URL where I can paste the whole gdb session? You can post them here, perhaps compressed. However, if they are all of the same kind, i.e. start with resize_echo_area_exactly, then I don't think more backtraces alone will help. Thanks.