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: Thu, 21 Sep 2023 10:36:53 +0900 Message-ID: References: <1808d5a1-3ee6-d675-3ad3-c6bcc2fe5e36@yk.rim.or.jp> <834jjqe85z.fsf@gnu.org> <80682fbe-b5ac-4605-b8e5-7baac2d71da5@yk.rim.or.jp> <83o7hxasfg.fsf@gnu.org> 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="30547"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 66096@debbugs.gnu.org, "ishikawa, chiaki" To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 21 03:37:05 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 1qj8cr-0007hl-1W for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Sep 2023 03:37:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qj8ch-0007nd-Um; Wed, 20 Sep 2023 21:36:55 -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 1qj8cf-0007nC-Kt for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2023 21:36:53 -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 1qj8ce-0003Q8-Nt for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2023 21:36:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qj8co-0005IV-49 for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2023 21:37: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: Thu, 21 Sep 2023 01:37:02 +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.169526017620303 (code B ref 66096); Thu, 21 Sep 2023 01:37:02 +0000 Original-Received: (at 66096) by debbugs.gnu.org; 21 Sep 2023 01:36:16 +0000 Original-Received: from localhost ([127.0.0.1]:60690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qj8c4-0005HP-0h for submit@debbugs.gnu.org; Wed, 20 Sep 2023 21:36:16 -0400 Original-Received: from mail04.siriuscloud.jp ([219.118.72.4]:39463) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qj8bz-0005HD-0I for 66096@debbugs.gnu.org; Wed, 20 Sep 2023 21:36:14 -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 access04.SiriusCloud.jp (Postfix) with ESMTPA id 4RrdJt34jjzlg4Cr; Thu, 21 Sep 2023 10:35:58 +0900 (JST) Authentication-Results: access04.SiriusCloud.jp; dkim=none reason="no signature"; dkim-adsp=none (unprotected policy); dkim-atps=neutral Content-Language: en-US In-Reply-To: <83o7hxasfg.fsf@gnu.org> X-Virus-Scanned: clamav-milter 0.98.6 at si-mail04 X-Virus-Status: Clean 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:270967 Archived-At: On 2023/09/20 22:24, Eli Zaretskii wrote: >> Date: Wed, 20 Sep 2023 16:09:03 +0900 >> Cc: 66096@debbugs.gnu.org, "ishikawa, chiaki" >> From: "ISHIKAWA,chiaki" >> >> I have the following code snippet to monitor GC issues on my PC for >> quite sometime. >> But I have not seen this particular problem before. >> The long pause I have seen before was strictly in GC-related routines. >> >> (setq my-gc-statistics (make-vector 30 nil)) >> >> ;;; The element is >> ;;; (append (memory-use-counts) (list gc-elapsed gcs-done)) >> ;;; Each time the following function is called, the >> ;;; elements in the array is shifted toward the end. >> ;;; Use (message "%S" my-gc-statistics) to force the >> ;;; recording of my-gc-statistics value in *Messages* buffer for later >> analysis. >> >> >> (defun update-my-gc-statistics () >>   (let ((i 28)) >>     (progn >>      ;;; very unlike Lisp >>      (while (<= 0 i) >>        (progn (aset my-gc-statistics (+ 1 i) (aref my-gc-statistics i)) >>              (setq i (- i 1) ))) >>      (aset my-gc-statistics 0 >>            (append (memory-use-counts) (list gc-elapsed gcs-done))) >>      ;;; print the latest one last so that I can see the glimpse in the >> narrow >>      ;;; output window. >>      (message "%S\n%S" (current-time-string) (pp (reverse >> my-gc-statistics)))))) >> >> (setq post-gc-hook 'update-my-gc-statistics) >> >> For example, in one place, I see >> #0  0x0000556f1905be9e in string_char_and_length >>     (length=, p=0x556f20d8a3d8 " 70337 417360 >> 2.323839139 50)\n (99058573 3875 59193441 34949 11084445 70337 417401 >> 2.391973008 51)]\n\"") at >> /home/ishikawa/repos/emacs-29.1/src/character.h:375 >> >> And that string is probably   from (append (memory-use-counts) (list >> gc-elapsed gcs-done)) > I tried to run with this, and I don't see any such infloop. I see the > GC results displayed in the echo-area once in a while. > > I guess some other customizations cause this, or maybe some special > circumstances with different fonts you use. Customizations that > affect the echo-area display and resizing are of main interest. If > you can try to reproduce this in "emacs -Q", with only the > post-gc-hook defined and as little of your other customizations as > possible, it could help. > >> Also I see recursive_edit at the bottom of the stakctrace. >> Not sure why. Maybe I was doing some error recovery of Japanese input? > No, this is normal: Emacs enters one level of recursive-edit when it > starts. Thank you for the comment. Yeah, I noticed strange font-related functions in a stacktrace. In any case, if I see the issue with a file being edited, I will report it. I have re-compiled emacs with the flags suggested in etc/DEBUG for now. Chiaki