From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node Date: Thu, 02 Mar 2023 13:53:54 +0800 Message-ID: <871qm7zojx.fsf@yahoo.com> References: <9FCDA5B7-D216-45B1-8051-35B05633BEFB@gmail.com> <83sfeukwsb.fsf@gnu.org> <574817C4-3FD8-43EA-B53C-B2BCB60A6D0A@gmail.com> <83mt51j6mv.fsf@gnu.org> <83a60xhou5.fsf@gnu.org> <83mt4wfvpd.fsf@gnu.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10818"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , mickey@masteringemacs.org, casouri@gmail.com, 60237@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 02 06:55:21 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 1pXbuS-0002c1-Mm for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Mar 2023 06:55:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXbuD-00041D-C5; Thu, 02 Mar 2023 00:55:05 -0500 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 1pXbuB-00040y-5g for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2023 00:55:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXbuA-0005jk-Q3 for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2023 00:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pXbuA-0008B3-E6 for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2023 00:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Mar 2023 05:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60237 X-GNU-PR-Package: emacs Original-Received: via spool by 60237-submit@debbugs.gnu.org id=B60237.167773645031371 (code B ref 60237); Thu, 02 Mar 2023 05:55:02 +0000 Original-Received: (at 60237) by debbugs.gnu.org; 2 Mar 2023 05:54:10 +0000 Original-Received: from localhost ([127.0.0.1]:55532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXbtJ-00089v-V9 for submit@debbugs.gnu.org; Thu, 02 Mar 2023 00:54:10 -0500 Original-Received: from sonic303-20.consmr.mail.ne1.yahoo.com ([66.163.188.146]:41270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXbtI-00089g-76 for 60237@debbugs.gnu.org; Thu, 02 Mar 2023 00:54:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1677736442; bh=RI9xMVyfLY/gYSFWa+jpt6y/uMwsD44dPxgG+sZGsCY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=uHRkx+Eh0/Z0aYLbOCdI0UpxDbRtCzH44udRUjoXWDmScnl1ujoA7fVoIBml2ozb/ssyhw2YFm0nVnf1LJiI7uruixferCpOcXcVUkXt6K/w+vyql1R5BtHQapgI9jB5InzCt7CLPht0AOYOpHS77vr6AFPYhe7KmwDBX3NT/ke2XAJoBUIIWHeD/yuGILJe5K88dzDtaTMlPpB1XBKSGAuno/iLIgS7DQJZsSre73zwt95BVGy9RTXxX6gd06qwkY3BUONA0jYEQYcnZkoOMfMf/xW0swRrl4xkbvD9OIz0JSYsJ0X/+FE7tA7nYtanoittVFqTLEsAMEtQkeqS6Q== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1677736442; bh=WtkcTIqo/62gEGNyRtlrrJpbqF0/QwQogpZxdbJP947=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=B4v7491Ky2N0kOyBo3NMUpH3PV09N/hdf6TMHLpvwks25zauRzjBivsix4V2azfQac0nYZxG/8IlAS4b/tmH3M2Q86EIABFbjobofAsOyeTnYhOBXA6FkmbB36r2i+ozvi0I/qzOr5NpNw54OHRKv0MkCfsg9MX72x71/eMTFA3KjALY69aZD5J4Js84DBcKC5VwyJdEFJDPHri2SRyDYadP3gw+ItkUlCdBWottm4wnYSlmGu48X3KO098/8U5G1UR9J6nU6ON97zyv1GURbFokXAivymG0HMNtHEb2tgpKHl/8U/DS/sUjgTZTvU1MzIHm7Qd/JiZQ58Ww0IsHaA== X-YMail-OSG: NjPRyZ0VM1mmi9WT2nIPkpaHnAhGGIbIcNNLldlxj8Aup2wZOJBNIMlce8IULM_ B6xw6Vw3hVQD2t7PH.7Gp7_NAOhIv8bb2O7.O.9dhjEfELLSS2YizuOaAKtBjUH2oq_JDTbaPKJW eVhnDi9ic4yF_6NtawN2HxR3ZJ0s41O96cOn3ZsBXYS3pQ.vOuUDHZcjBu.h_2AiTOfL16GAQiup DzOIEOHgwhQ7VbwKJO516.040zW9dxoD3A1e3sHnS4h8fivWKlZTsgdTQaj_ZOYNQW_PjyA1GF8P P8xt1U6OTP7b9uUrukjJEbcOlnM_AaVBpdkpCqjzeXm4n6uhMoooezKpWIUaOQu18kljNoRrQ_jp gAsiOerAblpNG4VjXmmZuQ0Gtraa9bx6cm28RaUif9Us8x2d.U62A3JBIYBVVaZPKP7PlgFFo0lc L0gvwgXbOx3VLgMi5_prJlpE54OUAWCB5DwKdhfMIfD69hE_K0G0dz6izgfryzyDbHO8NAkQ0ACO z6297mxKsa1lvUa1bktuJHRBO.BfbCy.NKj34cHEfEKUdFXg0A_mzFK9T7Oh4n1EwePi8K60MlXq hee9nd0pgq_SLofcfdyF9hLKLgaAIFm.bANFx8GGrj7AjKbsUI_V3Rd_3ABa3zevw6ezN4JVtrv0 1_lpYw3Rm8927K3RLr.Cf6DuH2EGs2T1BpIea.H2Mz7c1Td7Ofakqy5r1NqHvh.TFgZ37eetYl6o BcBHJ.tPMycDQiGQfz56ELkxGQ8.dYlpsfMhLSOXEfpP6Qo9Ps_HZGKDsoAr0UDB1EAquLsYqfK0 n1ykx3sSYUILRVneZDTO9keSsiUagXt_7EfZnO.6ui X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ne1.yahoo.com with HTTP; Thu, 2 Mar 2023 05:54:02 +0000 Original-Received: by hermes--production-sg3-9fc5746c8-xxb6k (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID e4a26da21794c4421549a9f459ac3669; Thu, 02 Mar 2023 05:54:00 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Wed, 01 Mar 2023 09:08:03 -0500") X-Mailer: WebService/1.1.21221 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo 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:257112 Archived-At: Stefan Monnier writes: > Eli Zaretskii [2023-03-01 15:27:26] wrote: > >>> From: Stefan Monnier >>> Cc: casouri@gmail.com, luangruo@yahoo.com, mickey@masteringemacs.org, >>> 60237@debbugs.gnu.org >>> Date: Tue, 28 Feb 2023 23:07:47 -0500 >>> >>> >> > Stefan, could it be a problem for us if garbage-collecting an object >>> >> > calls xmalloc? Including if the "memory" profiler is running at the >>> >> > time of that GC? >>> >> >>> >> I can't think of a fundamental reason why this would be a problem, but >>> >> as you've seen some code may not be quite ready for it. >>> >> >>> >> I suspect the simplest solution is to do something like what we do >>> >> for the cpu-profiler, i.e. handle the "time within GC" specially by >>> >> checking (EQ (backtrace_top_function (), QAutomatic_GC)) to determine >>> >> that we're within the GC. >>> > >>> > Any reason not to install the patch that uses gcsize instead of ASIZE? >>> >>> That might work, but I suspect there's a good reason why I used >>> `cpu_gc_count`. I think running the "normal" profiling code during GC >>> can cause other problems than just ASIZE because it can/will change >>> ELisp objects, and modifying the heap while we're doing GC is the >>> problem that concurrent GCs try to solve: our GC is not equipped >>> for that. >> >> Would you mind installing a change along these lines on the emacs-29 >> branch? I'm not familiar enough with profiler.c to experiment with >> its code on the release branch. > > For `emacs-29` I suggest we just use the patch below which should > circumvent the problem. > > > Stefan > > > diff --git a/src/profiler.c b/src/profiler.c > index 81b5e7b0cf0..c99ed0a81a2 100644 > --- a/src/profiler.c > +++ b/src/profiler.c > @@ -505,6 +505,8 @@ DEFUN ("profiler-memory-log", > void > malloc_probe (size_t size) > { > + if (EQ (backtrace_top_function (), QAutomatic_GC)) > + return; /* bug#60237 */ > eassert (HASH_TABLE_P (memory_log)); > record_backtrace (XHASH_TABLE (memory_log), min (size, MOST_POSITIVE_FIXNUM)); > } Shouldn't this be: if (gc_in_progress) return;