From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "ISHIKAWA,chiaki" 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 13:12:33 +0900 Message-ID: <1808d5a1-3ee6-d675-3ad3-c6bcc2fe5e36@yk.rim.or.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6429"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Cc: "ishikawa, chiaki" To: 66096@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 19 06:13:20 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 1qiS6x-0001Yi-K1 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Sep 2023 06:13:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiS6l-0007jL-T1; Tue, 19 Sep 2023 00:13:07 -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 1qiS6d-0007gd-Qp for bug-gnu-emacs@gnu.org; Tue, 19 Sep 2023 00:13:00 -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 1qiS6X-00071z-PF for bug-gnu-emacs@gnu.org; Tue, 19 Sep 2023 00:12:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qiS6g-0007fI-17 for bug-gnu-emacs@gnu.org; Tue, 19 Sep 2023 00:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "ISHIKAWA,chiaki" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Sep 2023 04:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66096 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.169509674229413 (code B ref -1); Tue, 19 Sep 2023 04:13:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Sep 2023 04:12:22 +0000 Original-Received: from localhost ([127.0.0.1]:55103 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiS62-0007eL-78 for submit@debbugs.gnu.org; Tue, 19 Sep 2023 00:12:22 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:33350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiS5x-0007e3-7O for submit@debbugs.gnu.org; Tue, 19 Sep 2023 00:12:21 -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 1qiS5i-0007FJ-TV for bug-gnu-emacs@gnu.org; Tue, 19 Sep 2023 00:12:02 -0400 Original-Received: from mail101.siriuscloud.jp ([219.118.72.101] helo=mail01.SiriusCloud.jp) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiS5e-0006uN-Pk for bug-gnu-emacs@gnu.org; Tue, 19 Sep 2023 00:12:01 -0400 Original-Received: from [192.168.0.77] (M106073032161.v4.enabler.ne.jp [106.73.32.161]) (Authenticated sender: ishikawa@yk.rim.or.jp) by access01.SiriusCloud.jp (Postfix) with ESMTPA id 4RqSsf6Pjlz35twCJ; Tue, 19 Sep 2023 13:11:50 +0900 (JST) Authentication-Results: access01.SiriusCloud.jp; dkim=none; dkim-atps=neutral Content-Language: en-US Received-SPF: pass client-ip=219.118.72.101; envelope-from=ishikawa@yk.rim.or.jp; helo=mail01.SiriusCloud.jp X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:270850 Archived-At: 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 file I was editing is a Japanese text file.  Sorry, it contains proprietary information and I can't share it immediately.  However, I will be editing it again with emacs this afternoon and if the problem recurs, I will try to redact it as much as possible and see if the runaway problem recurs then. 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? TIA. Regars, Chiaki One stacktrace with bidi_cache_searh at the top. I notice that charpos 358 was near the end of the file (probably at the end?) when I had to kill the emacs.. Sorry I had to recover the edited file after killing emacs, and it may no longer contain the exact buffer data when the problem occurred. thread 1 "emacs" received signal SIGINT, Interrupt. 0x0000556f1905af04 in bidi_cache_search (charpos=charpos@entry=358,     dir=dir@entry=1, level=-1) at bidi.c:660 660          if (charpos < bidi_cache[bidi_cache_last_idx].charpos) (gdb) where #0  0x0000556f1905af04 in bidi_cache_search     (charpos=charpos@entry=358, dir=dir@entry=1, level=-1) at bidi.c:660 #1  0x0000556f1905b8a9 in bidi_cache_find     (charpos=358, resolved_only=resolved_only@entry=false, bidi_it=bidi_it@entry=0x7ffeb7caae48) at bidi.c:877 #2  0x0000556f1905db97 in bidi_resolve_brackets     (bidi_it=bidi_it@entry=0x7ffeb7caae48) at bidi.c:2883 #3  0x0000556f1905df79 in bidi_resolve_neutral     (bidi_it=bidi_it@entry=0x7ffeb7caae48) at bidi.c:3010 #4  0x0000556f1905e4a1 in bidi_type_of_next_char (bidi_it=0x7ffeb7caae48)     at bidi.c:3215 #5  bidi_level_of_next_char (bidi_it=bidi_it@entry=0x7ffeb7caae48)     at bidi.c:3282 #6  0x0000556f1905f60e in bidi_move_to_visually_next     (bidi_it=bidi_it@entry=0x7ffeb7caae48) at bidi.c:3485 #7  0x0000556f18fe0d7a in set_iterator_to_next     (it=0x7ffeb7caa410, reseat_p=) at xdisp.c:8588 #8  0x0000556f18fdcb8d in move_it_in_display_line_to     (it=it@entry=0x7ffeb7caa410, to_charpos=to_charpos@entry=2078, to_x=to_x@entry=-1, op=op@entry=MOVE_TO_POS) at xdisp.c:10268 #9  0x0000556f18fe1b88 in move_it_to     (it=it@entry=0x7ffeb7caa410, to_charpos=2078, to_x=to_x@entry=-1, to_y=to_y@entry=-1, to_vpos=to_vpos@entry=-1, op=op@entry=8) at xdisp.c:10623 #10 0x0000556f18fe358c in resize_mini_window (w=0x556f1a3b4240, exact_p=true)     at xdisp.c:12778 #11 0x0000556f18fc973a in with_echo_area_buffer     (w=0x556f1a3b4240, which=which@entry=0, fn=fn@entry=0x556f18fe4250 , a1=0x556f1a3b4240, a2=0x30) at xdisp.c:12422 #12 0x0000556f18ff5269 in resize_echo_area_exactly () at xdisp.c:12678 #13 0x0000556f190de46d in command_loop_1 () at keyboard.c:1528 #14 0x0000556f19156377 in internal_condition_case     (bfun=bfun@entry=0x556f190ddcb0 , handlers=handlers@entry=0x90, hfun=hfun@entry=0x556f190d0f40 ) at eval.c:1474 #15 0x0000556f190c9bf6 in command_loop_2 (handlers=handlers@entry=0x90)     at keyboard.c:1133 #16 0x0000556f191562d1 in internal_catch     (tag=tag@entry=0x10080, func=func@entry=0x556f190c9bd0 , arg=arg@entry=0x90) at eval.c:1197 #17 0x0000556f190c9b91 in command_loop () at keyboard.c:1111 #18 0x0000556f190d0af1 in recursive_edit_1 () at keyboard.c:720 #19 0x0000556f190d0e70 in Frecursive_edit () at keyboard.c:803 #20 0x0000556f18fa3cf2 in main (argc=7, argv=0x7ffeb7cabd08) at emacs.c:2529 (gdb) c