From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier 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: Wed, 01 Mar 2023 09:08:03 -0500 Message-ID: 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: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33778"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: luangruo@yahoo.com, casouri@gmail.com, mickey@masteringemacs.org, 60237@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 01 15:10:58 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 1pXNAX-0008Zi-SE for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Mar 2023 15:10:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXN8n-0005fY-VB; Wed, 01 Mar 2023 09:09:10 -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 1pXN8h-0004zL-BK for bug-gnu-emacs@gnu.org; Wed, 01 Mar 2023 09:09: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 1pXN8h-000648-0i for bug-gnu-emacs@gnu.org; Wed, 01 Mar 2023 09:09:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pXN8g-0002pA-FW for bug-gnu-emacs@gnu.org; Wed, 01 Mar 2023 09:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Mar 2023 14:09: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.167767969310778 (code B ref 60237); Wed, 01 Mar 2023 14:09:02 +0000 Original-Received: (at 60237) by debbugs.gnu.org; 1 Mar 2023 14:08:13 +0000 Original-Received: from localhost ([127.0.0.1]:53065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXN7t-0002nl-2S for submit@debbugs.gnu.org; Wed, 01 Mar 2023 09:08:13 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:52310) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXN7r-0002nQ-IX for 60237@debbugs.gnu.org; Wed, 01 Mar 2023 09:08:12 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 269DB440C6E; Wed, 1 Mar 2023 09:08:06 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 81CC6440C54; Wed, 1 Mar 2023 09:08:04 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1677679684; bh=P9X88bLft3a4WJAWLGRMmJqOlgabxDl9RgsH/8kmlj4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=QikFytl+2OLtZlZpeh8VDEpsLGGzt/P0O8AwQo9YC1lbTPnqxCqzyw05ptkgZXQls CGKfoOByblnL5rUBVePPAbNGugnauT+erppRzTLHoFvPxABsuKFweFgFLDRI71+dQI Wd3Hz+AaU4tqNzaCRaSR/y/cytMZwOKUvBYZm45jmQ5bNEJyOpHu1/5Onp78Y3Oe96 G76/2MzVf01H0Y+zGbvbh9G7r4g582JEa5sBub9C8Rsm55batu6mXNRIobje7R3o8i GporKwhU1S8neXBWzrxzjpTqm65CVo+Us5SlWDaFjOW2U/PAd+9jUEbyz900nLR35a ccemx3fQUmjqA== Original-Received: from pastel (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4F97A12323F; Wed, 1 Mar 2023 09:08:04 -0500 (EST) In-Reply-To: <83mt4wfvpd.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 01 Mar 2023 15:27:26 +0200") 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:257064 Archived-At: 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)); }