GNU bug report logs - #70059
30.0.50; c-ts-mode crashes emacs

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Felix <felix.dick@HIDDEN>; dated Thu, 28 Mar 2024 20:38:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 2 Apr 2024 18:23:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 02 14:23:13 2024
Received: from localhost ([127.0.0.1]:56314 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rrimr-0004ME-MJ
	for submit <at> debbugs.gnu.org; Tue, 02 Apr 2024 14:23:13 -0400
Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:61442)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1rrimn-0004Kn-IJ
 for 70059 <at> debbugs.gnu.org; Tue, 02 Apr 2024 14:23:07 -0400
Received: by mail-pf1-x431.google.com with SMTP id
 d2e1a72fcca58-6e46dcd8feaso2538614b3a.2
 for <70059 <at> debbugs.gnu.org>; Tue, 02 Apr 2024 11:23:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1712082176; x=1712686976; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=nm/i0uXSXUf31ymip9OP3A4JUVu0MC2uxgKx1Sm5Fj8=;
 b=SxFsLSNNTJ3dEM6xeTYy5VJgBQ3zVi0cPQTqp4ptcbUMdSLRf978FxXOzOvhvYMqYC
 yVeobdFZzVN8kJfCAY5pJQDPpZsE8TdWP0ETJzUvW/VnoABPWSmAGY7L7TeuQISrk/PY
 22qbT447UoqIFDWFshNnYcSb1DrO+t4EPBdzpfCqMcdZVaSpXAYPtWQWbZ3I9ggAHpoI
 mSio24eFCxR07tzh847l5Bi8sNCtkUt+ve6F0YhyVTifd3SP9skzp3e5hpkELmHm0NLN
 OFYKFlHdZ1uRU0+3hYLXb3RQLsgjibmFVRMcP8UJ5XZsGOJcYMa6bYoZfZ1LG8Dco5qf
 hR9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1712082176; x=1712686976;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=nm/i0uXSXUf31ymip9OP3A4JUVu0MC2uxgKx1Sm5Fj8=;
 b=w0cd7f3vR/pFdsS7G0jM8t1HFz3TJbR7o4ZFway/BYUMIxOHTtZdDMcKPem1CgTHdt
 ESwlsmzPoJBuJidDakbF3oMn65JDH0jCijMyJGpIkKsJj24cMSJOP2VbACupRon/WkMY
 f6QL2e44/obFuOixguZjw0bfUHYAm4esVS/trf3Y1w1343v4HNmKZAzEW76sH7CS93Ab
 TwShS0h2NKuIlR4fb+jNFs++/u/WR7d7hT+7cAK82B/BZjeCNpBTinKSsvS/IFA82bE9
 SHhMUPH+slzLBS5PRKgVJ94/4NN7aZUlHVzbyq/KUbUtccD1FrNjaQVGjgWM7iUGWEFz
 O3PQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCX9OpoCuKpS1jUqm2gJ1K7u7aDh+vLpWnwllSE2efhofP0i0UqqyWdz+Ebk5KpEcZTOl0yGHwNpg7IUsHsnw7JhSf8Reho=
X-Gm-Message-State: AOJu0YwlALWogszReVOpAJrCYz6u4oAUoSpBjfif9m3Wr+W5eiGivcAT
 mrI5/PWm21SnJnVQnCKxrVeZywCm3ss9mqav4pJYO4X5FVIGS0EMfTTk9JpP
X-Google-Smtp-Source: AGHT+IFOtkAGd4oLnjeu3rIXbVsqpovDkI561apr9bz2pPBaKEDHt6yliwCxgXIVJQZ3Fs4TKAcacw==
X-Received: by 2002:a05:6a20:5649:b0:1a3:c897:b67c with SMTP id
 is9-20020a056a20564900b001a3c897b67cmr10037177pzc.52.1712082175849; 
 Tue, 02 Apr 2024 11:22:55 -0700 (PDT)
Received: from smtpclient.apple ([2601:641:300:4910:3c86:aadd:4f00:56cd])
 by smtp.gmail.com with ESMTPSA id
 jf5-20020a170903268500b001e28654d2a6sm816854plb.219.2024.04.02.11.22.55
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 02 Apr 2024 11:22:55 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\))
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <87a5mex1oi.fsf@HIDDEN>
Date: Tue, 2 Apr 2024 11:22:44 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <57C4D40E-15B1-4A8C-8FA7-C01A16A81BA9@HIDDEN>
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
 <87il15wbtx.fsf@HIDDEN> <86zfuhe0uo.fsf@HIDDEN> <878r218e1s.fsf@HIDDEN>
 <86wmpldyve.fsf@HIDDEN> <92195FEF-E940-41F7-B1A8-EC1607D9473E@HIDDEN>
 <87a5mex1oi.fsf@HIDDEN>
To: Felix <felix.dick@HIDDEN>
X-Mailer: Apple Mail (2.3731.700.6)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 70059
Cc: Eli Zaretskii <eliz@HIDDEN>, 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Mar 31, 2024, at 1:09 AM, Felix <felix.dick@HIDDEN> wrote:
>=20
> Yuan Fu <casouri@HIDDEN> writes:
>=20
>>> On Mar 29, 2024, at 5:08 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
>>>=20
>>>> From: Felix <felix.dick@HIDDEN>
>>>> Cc: Yuan Fu <casouri@HIDDEN>,  70059 <at> debbugs.gnu.org
>>>> Date: Fri, 29 Mar 2024 12:37:03 +0100
>>>>=20
>>>> Eli Zaretskii <eliz@HIDDEN> writes:
>>>>=20
>>>>>> From: Felix <felix.dick@HIDDEN>
>>>>>> Cc: Andrea Corallo <acorallo@HIDDEN>,  70059 <at> debbugs.gnu.org
>>>>>> Date: Fri, 29 Mar 2024 11:51:06 +0100
>>>>>>=20
>>>>>> I rebuild it without native-compilation, and it still crashes.
>>>>>> Backtrace:
>>>>>>=20
>>>>>> #0  0x000077b79c65c32c in ??? () at /usr/lib/libc.so.6
>>>>>> #1  0x000077b79c60b6c8 in raise () at /usr/lib/libc.so.6
>>>>>> #2  0x00005a5a428f94a2 in terminate_due_to_signal ()
>>>>>> #3  0x00005a5a42933c23 in emacs_abort ()
>>>>>> #4  0x00005a5a429ec268 in signal_or_quit ()
>>>>>> #5  0x00005a5a429eb422 in Fsignal ()
>>>>>> #6  0x00005a5a429eb401 in xsignal ()
>>>>>> #7  0x00005a5a429e9aa2 in xsignal2 ()
>>>>>> #8  0x00005a5a429c0865 in wrong_type_argument ()
>>>>>> #9  0x00005a5a42965e1f in Fexpand_file_name ()
>>>>>> #10 0x00005a5a42b3d200 in Fdo_auto_save.7873 ()
>>>>>> #11 0x00005a5a428f9738 in shut_down_emacs ()
>>>>>> #12 0x00005a5a428f946a in terminate_due_to_signal ()
>>>>>> #13 0x00005a5a42935924 in handle_sigsegv ()
>>>>>> #14 0x000077b79c60b770 in <signal handler called> () at =
/usr/lib/libc.so.6
>>>>>> #15 0x00005a5a429a57f6 in process_mark_stack ()
>>>>>> #16 0x00005a5a429a677b in mark_char_table ()
>>>>>> #17 0x00005a5a429a68c6 in mark_char_table ()
>>>>>> #18 0x00005a5a429a55bd in process_mark_stack ()
>>>>>> #19 0x00005a5a429a677b in mark_char_table ()
>>>>>> #20 0x00005a5a429a68c6 in mark_char_table ()
>>>>>> #21 0x00005a5a429a55bd in process_mark_stack ()
>>>>>> #22 0x00005a5a429a677b in mark_char_table ()
>>>>>> #23 0x00005a5a429a68c6 in mark_char_table ()
>>>>>> #24 0x00005a5a429a55bd in process_mark_stack ()
>>>>>> #25 0x00005a5a429a677b in mark_char_table ()
>>>>>> #26 0x00005a5a429a68c6 in mark_char_table ()
>>>>>> #27 0x00005a5a429a55bd in process_mark_stack ()
>>>>>> #28 0x00005a5a429a569b in process_mark_stack ()
>>>>>> #29 0x00005a5a429a569b in process_mark_stack ()
>>>>>> #30 0x00005a5a429a569b in process_mark_stack ()
>>>>>> #31 0x00005a5a429a7b8e in garbage_collect ()
>>>>>> #32 0x00005a5a429e76e7 in Ffuncall ()
>>>>>> #33 0x00005a5a42a094f7 in mapcar1 ()
>>>>>> #34 0x00005a5a42a091bf in Fmapconcat ()
>>>>>> #35 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
>>>>>> #36 0x00005a5a429e87b3 in funcall_subr ()
>>>>>> #37 0x00005a5a429e77f6 in Ffuncall ()
>>>>>> #38 0x00005a5a42a094f7 in mapcar1 ()
>>>>>> #39 0x00005a5a42a091bf in Fmapconcat ()
>>>>>> #40 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
>>>>>> #41 0x00005a5a429e87b3 in funcall_subr ()
>>>>>> #42 0x00005a5a429e77f6 in Ffuncall ()
>>>>>> #43 0x00005a5a42a094f7 in mapcar1 ()
>>>>>> #44 0x00005a5a42a091bf in Fmapconcat ()
>>>>>> #45 0x00005a5a42aca243 in treesit_ensure_query_compiled ()
>>>>>> #46 0x00005a5a42aca5c0 in Ftreesit_query_capture ()
>>>>>=20
>>>>> Then it's strange, since it doesn't happen here.  Does it happen =
for
>>>>> you with any C source file, including those in the Emacs source =
tree?
>>>>> If this happens only for some files, can you post one such file?
>>>>>=20
>>>>> Also, what version of the tree-sitter library are you using, and =
what
>>>>> version of the C grammar library?
>>>>>=20
>>>>> If you can build the emacs-29 branch, can you try reproducing =
there?
>>>>>=20
>>>>> Yuan, any ideas, based on the backtrace?
>>>>=20
>>>> I was using tree-sitter build from the git repository, when i use =
it
>>>> from the official arch linux repos, it doesn't crash (at least =
until
>>>> now).
>>>> I think this is tree-sitter related, but it shouldn't be able to =
crash
>>>> emacs, should it?
>>>=20
>>> It shouldn't, unless there's some memory-related snafu (which could
>>> explain why the crash is always in GC).  I hope Yuan will be able to
>>> tell.
>>=20
>> It=E2=80=99s a bit strange since Ftreesit_pattern_expand doesn=E2=80=99=
t call
>> tree-sitter function. This function just expands a sexp query like
>> '(function_definition @capture) to a string =E2=80=9C(function_definiti=
on
>> @capture)=E2=80=9D.
>>=20
>> Perhaps something it does triggers GC and GC tries to collect some =
tree-sitter node or parser, and there=E2=80=99s some problem when =
freeing the node or parser with that version of tree-sitter library.
>>=20
>> Also, I couldn=E2=80=99t reproduce with upstream tree-sitter plus =
emacs master
>> either. I=E2=80=99m using commit =
0b4403294981ffb6a51d153a5509a389b91fed86 for
>> tree-sitter and commit 411f46fd365bc0008c58e1fa6bee6a60d841da75 for
>> emacs. Felix, what commit are you using?
>>=20
>> Yuan
>=20
> It still crashes on my computer if i use:
> GNU Emacs 30.0.50 (build 11, x86_64-pc-linux-gnu, GTK+ Version =
3.24.41, cairo version 1.18.0) of 2024-03-31
> and
> tree-sitter 0.22.2 (fc15f621334a262039ffaded5937e2844f88da61)
>=20
> But as i wrote, it doesn't crash with tree-sitter from the official =
arch
> linux repos, and because i program in C every day, i switched to the
> stable tree-sitter and had no problems since.
>=20
> That's why i asked if a faulty tree-sitter should be able to crash
> emacs. If that is acceptable, this bug report can be closed.

I mean tree-sitter (the library) runs in the main thread, if it triggers =
a segfault, AFAIK Emacs currently can=E2=80=99t really do anything. Is =
that right Eli?

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 2 Apr 2024 18:20:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 02 14:20:56 2024
Received: from localhost ([127.0.0.1]:56310 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rrikg-00049j-Ru
	for submit <at> debbugs.gnu.org; Tue, 02 Apr 2024 14:20:56 -0400
Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:54608)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1rrikd-00048k-0U
 for 70059 <at> debbugs.gnu.org; Tue, 02 Apr 2024 14:20:52 -0400
Received: by mail-pf1-x436.google.com with SMTP id
 d2e1a72fcca58-6e6bee809b8so5187709b3a.1
 for <70059 <at> debbugs.gnu.org>; Tue, 02 Apr 2024 11:20:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1712082041; x=1712686841; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=fxxXc0vXHrRgjfgZh+isbPlrg8U94gPRT0BV+cv+18w=;
 b=LsRA7+Wr24bWzz5cuTtU4AZvATLMhaoZWVOFBfOWnuKzyu9B+sWvYMpwri9IlL2IRq
 IgeXOclrOfRbyqaU9AP3JSXhabEKMr9mOcPwqZwJ5jQ63kM9mqrsRUFCXFXbD0OqyinM
 0YjfqHM33raTqV013dVwtLfOuLxyOhkwdUs5ioyU3/cXVL5pxwCrFJWRB0dcJI+/MSbR
 gB7PtcWqPVnCajvXnOvaf0gJrhzB+ZLOGNNTIwWxPlrquKExvGhyJpayEV3F7HzmzU9e
 LOfysCfbf8qsYzqyQEVBK6rq/kFk70ey61EcVCqyQ6fkM/2rSNNJgylqDV57DYQV/qJ7
 f9LQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1712082041; x=1712686841;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=fxxXc0vXHrRgjfgZh+isbPlrg8U94gPRT0BV+cv+18w=;
 b=r2e3rqAFmeLzi55gv9BZlQbMhZUwRopGzUjAZc5KsFIMEQfFoSmFnJQdaEZ59EVVuU
 Ic56NSInIrqeqrTat0CJmgK5+lLW26XIQS1ssdiperbpid9SqagLqem8pHkAubX0970m
 lkEOi9VyTuOV9P7C/sT/LBx8FG4MHJMvDnkBofhsmrc524GRiEzJtnhz6+KrSun0iakd
 l245rYDPeRyPTe41Os9TXhrG7T5tftjbM95zqzIsxhi/XYmeyAuwIcQE+qEQczCyXuES
 y61jkKlwNaGx8hIjO/5JLfM/TIHrzwz7aEKzyD08L/CWYziPq+Z10fEUVMxNBwUN4cqu
 rjNQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCXhNeb1uO9TLqq3PqCVc0a19DyYo9WG/U3NHuwI8LUdP0rnBkeRkdDNB54ELVf1fJmW/FtoX8lR0HFYg8H5dS/E/QuO7s0=
X-Gm-Message-State: AOJu0YxhPtEEcC7wytrvqHvwD7emETCEAmsGFLMxQefFoyX8EOu51cxI
 9oDWQ/knex3HTY7nz2//r4YVdOk6ovKZYGRI/m32nLusAyfJVqYz
X-Google-Smtp-Source: AGHT+IExehTp+N81jLQqcBAiCAm1vG2yf00hSttE6RmyiG8G3TpKul45aaeSZK6slcBdT7zNX+m95g==
X-Received: by 2002:a05:6a00:398e:b0:6eb:3fa8:c8f8 with SMTP id
 fi14-20020a056a00398e00b006eb3fa8c8f8mr7802823pfb.3.1712082039934; 
 Tue, 02 Apr 2024 11:20:39 -0700 (PDT)
Received: from smtpclient.apple ([2601:641:300:4910:886c:a076:1269:1e50])
 by smtp.gmail.com with ESMTPSA id
 i18-20020aa78b52000000b006ea7e972947sm10131573pfd.130.2024.04.02.11.20.38
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 02 Apr 2024 11:20:39 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\))
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <86msqec0cr.fsf@HIDDEN>
Date: Tue, 2 Apr 2024 11:20:27 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <8841FAEB-211D-40B6-B1C9-7F2B22B1ACD6@HIDDEN>
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
 <87il15wbtx.fsf@HIDDEN> <86zfuhe0uo.fsf@HIDDEN> <878r218e1s.fsf@HIDDEN>
 <86wmpldyve.fsf@HIDDEN> <92195FEF-E940-41F7-B1A8-EC1607D9473E@HIDDEN>
 <86msqec0cr.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3731.700.6)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 70059
Cc: felix.dick@HIDDEN, 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Mar 31, 2024, at 12:43 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
>=20
>> From: Yuan Fu <casouri@HIDDEN>
>> Date: Sat, 30 Mar 2024 22:52:55 -0700
>> Cc: Felix <felix.dick@HIDDEN>,
>> 70059 <at> debbugs.gnu.org
>>=20
>> It=E2=80=99s a bit strange since Ftreesit_pattern_expand doesn=E2=80=99=
t call tree-sitter function. This function just expands a sexp query =
like '(function_definition @capture) to a string =E2=80=9C(function_defini=
tion @capture)=E2=80=9D.=20
>=20
> I'm not sure I follow: the backtrace shows that
> Ftreesit_pattern_expand called Fmapconcat, and I do see a call to
> Fmapconcat in Ftreesit_pattern_expand.  So what did you mean by
> "Ftreesit_pattern_expand doesn't call tree-sitter function"?

I should've been more precise, I mean it doesn=E2=80=99t call functions =
from tree-sitter library.

>=20
>> Perhaps something it does triggers GC and GC tries to collect some =
tree-sitter node or parser, and there=E2=80=99s some problem when =
freeing the node or parser with that version of tree-sitter library.
>=20
> Again, not sure I follow: according to the backtrace, Fmapconcat
> called mapconcat1, which called Ffuncall.  And Ffuncall is known to
> trigger GC if needed.

Ah, I didn=E2=80=99t know it, thanks for explaining that.

Yuan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 31 Mar 2024 08:09:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 31 04:09:46 2024
Received: from localhost ([127.0.0.1]:46527 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqqG9-0003FC-Oq
	for submit <at> debbugs.gnu.org; Sun, 31 Mar 2024 04:09:46 -0400
Received: from mout.web.de ([212.227.15.14]:38207)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felix.dick@HIDDEN>) id 1rqqG7-0003Et-NG
 for 70059 <at> debbugs.gnu.org; Sun, 31 Mar 2024 04:09:44 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
 s=s29768273; t=1711872574; x=1712477374; i=felix.dick@HIDDEN;
 bh=jDhBG3DjP2ES7WyyO1mY37JhGMXYAnQtPsUEamJMZ6M=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:
 Date;
 b=t4M+RMBXYmohWTrSLXdsYibJhw+OlwdF9rh65R/uJ6VQRngzTN7C3ZrBGpoQ/f3l
 z8rLJ62+HEnnJ6R+0h1rMdwOTtfZjafDDGB8qKSrFXli+MnxneNKfpBsDBRA+J2W3
 Qw+Z4Y8x2BxsDcaSJ/uQYqKXYmrHI5GPpGDAHhp7MtrA84QVlvQs9mqXpdKaoXItS
 4KSTY+l2+hR6l9m515CaEmwzxVK80qaJvHcDBYtZw3i597EmJ1kpda9XlbXep+FqW
 Ft18XI9biIbMhpG+I8JCPuCyAg4TG3HlC5IqPPktIUnAolnxU7QdoCJXqyimWjSrh
 NvdT3ETAJniRe8gqcA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from felix-lifebooka531.web.de ([95.91.213.243]) by smtp.web.de
 (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id
 1M5j1q-1rtZ0W1NW6-00FhcJ; Sun, 31 Mar 2024 10:09:34 +0200
From: Felix <felix.dick@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
In-Reply-To: <92195FEF-E940-41F7-B1A8-EC1607D9473E@HIDDEN> (Yuan Fu's
 message of "Sat, 30 Mar 2024 22:52:55 -0700")
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
 <87il15wbtx.fsf@HIDDEN> <86zfuhe0uo.fsf@HIDDEN>
 <878r218e1s.fsf@HIDDEN> <86wmpldyve.fsf@HIDDEN>
 <92195FEF-E940-41F7-B1A8-EC1607D9473E@HIDDEN>
User-Agent: mu4e 1.12.2; emacs 30.0.50
Date: Sun, 31 Mar 2024 10:09:33 +0200
Message-ID: <87a5mex1oi.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K1:K4N+CNxafI48sOIhUOc5bNQg71FczJgO7JC2E9QVxoycHoQPEnG
 TwUcQmn1BXbaH+D45RTui2NQUWphfrYb/clLdNI4W54feuWzbTraSmbcqY4JVL1d9s2Z8Xk
 d2dkljX72pVPi00mDUH0XxxhO7BGCa2vBtF0NV5Szv026WreOJGwsJ2dzS+c9bBg7jeM1c8
 Xw9UysnaQcZqWZhpdG0kw==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:CB4dUng7Zow=;1VkWd84PdC3JkBayxt59ZaKsOop
 ZXH+MObOv5Wv050AjT69CLlP+3lms4qrPKmmqNKKhPG0HnLM+PK+Zmkk9zoHVYh/bcETTXsNk
 rySZxGzafBXui8ccqO0laT6bjhw2FjQke/qbMESt4oeWHxDQaB4U0ClvEIH6vqM23Oc727ZCx
 AfaFl7OixZWcJDiNSXKO7qsr8Vy7NFDQf+8ukilvPL0vB8TZg6M8lcQ/ODBSndDy4QPPofcJe
 voj6JiShUpTeUI6ZGLPehrYmA6ivQqD1jZmU4mWfIqKzSd920iwkjP+nYyJpyleACxGP4eoEk
 8v7KGtmwHrigFxV3gscHLmvr6xprXK0++Ujl7RgxCZp/8uRtju7cgBEtLl3ZbmAywUe+OvZjA
 t70+D/4FKIoOaUXEKFazsh06u3qptHG0oETe4bRPSjbEG8jvUl/1WbDksPe3K/gOEp6/pumwv
 NMNC9k7aH5BSVus0PUSlaWiigjQf69cWx229tsfEaLIkb12fGKpUQiRkHfZuo75VCbPB+9yzq
 wLCa4xYvXWkh3TBu3nJAyzoxmpuqdOjq6pulzUKez2gWxlCcrEbMb2Ffpk2TUP3O45sCbx2B1
 rsHQZde7duPIswj+w2TxsH5Go9PzRC1gm+1HenOM7gZ5XtW3/nwLlnfQ+8ri9oU0Pi3EwM24g
 5ox0yfqqVLLb0BQY68CsDOBkR1kcRMbpUBQzww/z6dqXXmQedYMrP6gzqrG4bWLyDj0Y2E3zb
 FgQ7FbULVsdTh37uAsHMfPVk+v0O22yYUieumvwaLI/nmBLYZuKr1IyxTtN+/GIowhdPh0DZw
 2+6gvAJsCf7/n4vVJ1fAureSxgJ5l1F2ctqE2jYYeUwlI=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 70059
Cc: Eli Zaretskii <eliz@HIDDEN>, 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Yuan Fu <casouri@HIDDEN> writes:

>> On Mar 29, 2024, at 5:08 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
>>
>>> From: Felix <felix.dick@HIDDEN>
>>> Cc: Yuan Fu <casouri@HIDDEN>,  70059 <at> debbugs.gnu.org
>>> Date: Fri, 29 Mar 2024 12:37:03 +0100
>>>
>>> Eli Zaretskii <eliz@HIDDEN> writes:
>>>
>>>>> From: Felix <felix.dick@HIDDEN>
>>>>> Cc: Andrea Corallo <acorallo@HIDDEN>,  70059 <at> debbugs.gnu.org
>>>>> Date: Fri, 29 Mar 2024 11:51:06 +0100
>>>>>
>>>>> I rebuild it without native-compilation, and it still crashes.
>>>>> Backtrace:
>>>>>
>>>>> #0  0x000077b79c65c32c in ??? () at /usr/lib/libc.so.6
>>>>> #1  0x000077b79c60b6c8 in raise () at /usr/lib/libc.so.6
>>>>> #2  0x00005a5a428f94a2 in terminate_due_to_signal ()
>>>>> #3  0x00005a5a42933c23 in emacs_abort ()
>>>>> #4  0x00005a5a429ec268 in signal_or_quit ()
>>>>> #5  0x00005a5a429eb422 in Fsignal ()
>>>>> #6  0x00005a5a429eb401 in xsignal ()
>>>>> #7  0x00005a5a429e9aa2 in xsignal2 ()
>>>>> #8  0x00005a5a429c0865 in wrong_type_argument ()
>>>>> #9  0x00005a5a42965e1f in Fexpand_file_name ()
>>>>> #10 0x00005a5a42b3d200 in Fdo_auto_save.7873 ()
>>>>> #11 0x00005a5a428f9738 in shut_down_emacs ()
>>>>> #12 0x00005a5a428f946a in terminate_due_to_signal ()
>>>>> #13 0x00005a5a42935924 in handle_sigsegv ()
>>>>> #14 0x000077b79c60b770 in <signal handler called> () at /usr/lib/libc=
.so.6
>>>>> #15 0x00005a5a429a57f6 in process_mark_stack ()
>>>>> #16 0x00005a5a429a677b in mark_char_table ()
>>>>> #17 0x00005a5a429a68c6 in mark_char_table ()
>>>>> #18 0x00005a5a429a55bd in process_mark_stack ()
>>>>> #19 0x00005a5a429a677b in mark_char_table ()
>>>>> #20 0x00005a5a429a68c6 in mark_char_table ()
>>>>> #21 0x00005a5a429a55bd in process_mark_stack ()
>>>>> #22 0x00005a5a429a677b in mark_char_table ()
>>>>> #23 0x00005a5a429a68c6 in mark_char_table ()
>>>>> #24 0x00005a5a429a55bd in process_mark_stack ()
>>>>> #25 0x00005a5a429a677b in mark_char_table ()
>>>>> #26 0x00005a5a429a68c6 in mark_char_table ()
>>>>> #27 0x00005a5a429a55bd in process_mark_stack ()
>>>>> #28 0x00005a5a429a569b in process_mark_stack ()
>>>>> #29 0x00005a5a429a569b in process_mark_stack ()
>>>>> #30 0x00005a5a429a569b in process_mark_stack ()
>>>>> #31 0x00005a5a429a7b8e in garbage_collect ()
>>>>> #32 0x00005a5a429e76e7 in Ffuncall ()
>>>>> #33 0x00005a5a42a094f7 in mapcar1 ()
>>>>> #34 0x00005a5a42a091bf in Fmapconcat ()
>>>>> #35 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
>>>>> #36 0x00005a5a429e87b3 in funcall_subr ()
>>>>> #37 0x00005a5a429e77f6 in Ffuncall ()
>>>>> #38 0x00005a5a42a094f7 in mapcar1 ()
>>>>> #39 0x00005a5a42a091bf in Fmapconcat ()
>>>>> #40 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
>>>>> #41 0x00005a5a429e87b3 in funcall_subr ()
>>>>> #42 0x00005a5a429e77f6 in Ffuncall ()
>>>>> #43 0x00005a5a42a094f7 in mapcar1 ()
>>>>> #44 0x00005a5a42a091bf in Fmapconcat ()
>>>>> #45 0x00005a5a42aca243 in treesit_ensure_query_compiled ()
>>>>> #46 0x00005a5a42aca5c0 in Ftreesit_query_capture ()
>>>>
>>>> Then it's strange, since it doesn't happen here.  Does it happen for
>>>> you with any C source file, including those in the Emacs source tree?
>>>> If this happens only for some files, can you post one such file?
>>>>
>>>> Also, what version of the tree-sitter library are you using, and what
>>>> version of the C grammar library?
>>>>
>>>> If you can build the emacs-29 branch, can you try reproducing there?
>>>>
>>>> Yuan, any ideas, based on the backtrace?
>>>
>>> I was using tree-sitter build from the git repository, when i use it
>>> from the official arch linux repos, it doesn't crash (at least until
>>> now).
>>> I think this is tree-sitter related, but it shouldn't be able to crash
>>> emacs, should it?
>>
>> It shouldn't, unless there's some memory-related snafu (which could
>> explain why the crash is always in GC).  I hope Yuan will be able to
>> tell.
>
> It=E2=80=99s a bit strange since Ftreesit_pattern_expand doesn=E2=80=99t =
call
> tree-sitter function. This function just expands a sexp query like
> '(function_definition @capture) to a string =E2=80=9C(function_definition
> @capture)=E2=80=9D.
>
> Perhaps something it does triggers GC and GC tries to collect some tree-s=
itter node or parser, and there=E2=80=99s some problem when freeing the nod=
e or parser with that version of tree-sitter library.
>
> Also, I couldn=E2=80=99t reproduce with upstream tree-sitter plus emacs m=
aster
> either. I=E2=80=99m using commit 0b4403294981ffb6a51d153a5509a389b91fed86=
 for
> tree-sitter and commit 411f46fd365bc0008c58e1fa6bee6a60d841da75 for
> emacs. Felix, what commit are you using?
>
> Yuan

It still crashes on my computer if i use:
GNU Emacs 30.0.50 (build 11, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cai=
ro version 1.18.0) of 2024-03-31
and
tree-sitter 0.22.2 (fc15f621334a262039ffaded5937e2844f88da61)

But as i wrote, it doesn't crash with tree-sitter from the official arch
linux repos, and because i program in C every day, i switched to the
stable tree-sitter and had no problems since.

That's why i asked if a faulty tree-sitter should be able to crash
emacs. If that is acceptable, this bug report can be closed.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 31 Mar 2024 07:44:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 31 03:44:01 2024
Received: from localhost ([127.0.0.1]:46521 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqprF-0007A7-Cy
	for submit <at> debbugs.gnu.org; Sun, 31 Mar 2024 03:44:01 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57774)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rqprE-00079d-5K
 for 70059 <at> debbugs.gnu.org; Sun, 31 Mar 2024 03:44:01 -0400
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 <eliz@HIDDEN>)
 id 1rqpr6-0003pl-8X; Sun, 31 Mar 2024 03:43:52 -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=PQ+ob5lpbhNa1mLwZbND3Ii5RrhZotalqTeEXu+bsg0=; b=oeHBcnTZaYRTIwNbEKJE
 aX7YtbjxeupQxixqkycW/EdT6AkrGdEwZsjMnU2V9rwhnWZWB1E1jFQsWVhFUH0iS2i5ufV2LzSU+
 ysgRvDFBouLtZi8cBENW3j9CcIKxrIPQwKftg+OncppBbdJ4v9SZezFdyf0vS4I+q5M66U/VCsTsp
 PX4hgL7vHXtmWOjJvoqj0d9Ia2Sqz+cr3o0ottVSDkCsYCaSAl0J8mGVdAU2jPFjnMVKshIPV+K2v
 FyIVpzyQElKwqHQITo9SHPLWMrnGfCG4KYFrBIkSqRpMUCU7VBirYjFX1OX9cq2C/7s3XJfyi6HhY
 gHcSYRE2EchkXg==;
Date: Sun, 31 Mar 2024 10:43:48 +0300
Message-Id: <86msqec0cr.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <92195FEF-E940-41F7-B1A8-EC1607D9473E@HIDDEN> (message from
 Yuan Fu on Sat, 30 Mar 2024 22:52:55 -0700)
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
 <87il15wbtx.fsf@HIDDEN> <86zfuhe0uo.fsf@HIDDEN> <878r218e1s.fsf@HIDDEN>
 <86wmpldyve.fsf@HIDDEN> <92195FEF-E940-41F7-B1A8-EC1607D9473E@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70059
Cc: felix.dick@HIDDEN, 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Yuan Fu <casouri@HIDDEN>
> Date: Sat, 30 Mar 2024 22:52:55 -0700
> Cc: Felix <felix.dick@HIDDEN>,
>  70059 <at> debbugs.gnu.org
> 
> It’s a bit strange since Ftreesit_pattern_expand doesn’t call tree-sitter function. This function just expands a sexp query like '(function_definition @capture) to a string “(function_definition @capture)”. 

I'm not sure I follow: the backtrace shows that
Ftreesit_pattern_expand called Fmapconcat, and I do see a call to
Fmapconcat in Ftreesit_pattern_expand.  So what did you mean by
"Ftreesit_pattern_expand doesn't call tree-sitter function"?

> Perhaps something it does triggers GC and GC tries to collect some tree-sitter node or parser, and there’s some problem when freeing the node or parser with that version of tree-sitter library.

Again, not sure I follow: according to the backtrace, Fmapconcat
called mapconcat1, which called Ffuncall.  And Ffuncall is known to
trigger GC if needed.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 31 Mar 2024 05:53:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 31 01:53:20 2024
Received: from localhost ([127.0.0.1]:46461 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqo87-0000mx-Oh
	for submit <at> debbugs.gnu.org; Sun, 31 Mar 2024 01:53:20 -0400
Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]:50249)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1rqo82-0000me-Mp
 for 70059 <at> debbugs.gnu.org; Sun, 31 Mar 2024 01:53:18 -0400
Received: by mail-il1-x12b.google.com with SMTP id
 e9e14a558f8ab-3688676cc70so13240885ab.0
 for <70059 <at> debbugs.gnu.org>; Sat, 30 Mar 2024 22:53:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1711864386; x=1712469186; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=M3Syhgm3BgBz5qmwa3izEUd6nGsVyjYlREYjMUlswkI=;
 b=ZrvWXY3rhvtQul0CKjQuPrOQENSYu8rmQdOUbz1l8SHZsfqZTwfV3d1Vy9m9gxsxSi
 D27lSk7q+62yNkyRxe1n3T2FOhho+IRXlWVILQ3LdJiWLJf1wNBQDmrN08xlyuYlO2/f
 zLgIu27ThMWJS4Vnc/tIAcNO75bFX5ncjXL08MDydw0iUUAwH1SBLD0AjhBCpxH5HokF
 X5U7TpCmvA1saDQXlZzVGo9ewSuqDaqqxLFOZ0COYUW4/KgPW/3YuWf1RODLOdMrad+1
 n2bHh8GN8MEi07ec7h40ZKHtWAxtIGIkl6Qomp1GXpgFhoWymE0lVjHx4ryEYiTaUbhv
 aUhw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1711864386; x=1712469186;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=M3Syhgm3BgBz5qmwa3izEUd6nGsVyjYlREYjMUlswkI=;
 b=MgozUIKeCiWbISI/YyKAbcVla4701tdvG3GCWyxiJjqiJLoqdWF+ylOTKhFoBiKaua
 mKDbwuhiQKOCCW2BvYmryNi/e0HnN5GOMoCgfpmS4btST7mUr5i+0aWvHA66X9QEQEal
 Dez9koCQuuClq8yf7inTZGusY0BDhCjEagjGbGdlKb3oHIQs1HkZ7zjg0P+03h6Ay/Rc
 QWTFDcLlK7u2mbMhVbMv4+zIWCRQlVpvnb0D1N+5D/f/UJU3vokRfUUUME8Lj/iuynRn
 aVUswmWZgVeQ3J1d3oVRLYVvK0qc6hsV2eBeuY64s1CIY1hBDJhkWvUs1DZgAUnmO/kv
 9krw==
X-Forwarded-Encrypted: i=1;
 AJvYcCXFmLDf/JRAfH0iPvjIGwN5r3+yKl/lDtBJ2qhH+DIeHD2UpsXBXLOmxQ8Kvwc2MEVfqo4Mj6Lp6Z1+MHW6rO55q7z0erg=
X-Gm-Message-State: AOJu0YwscCKJnOgim+KBZduPterKM2S+SIfGrmwN93tdvw78vXHRlnIL
 QL5p7cvasnPEhEit4KuFkt9g6cWoTVo3oS2xhuxpk4AqG4xg3H1F
X-Google-Smtp-Source: AGHT+IFUL31lXFiDr9dLhcxOIBgHUUsjBp3ssohS1hK7VcIFiW1fmvgKcvPVKrbf6Aocr6rudcAwsQ==
X-Received: by 2002:a92:c548:0:b0:368:efa4:bdf4 with SMTP id
 a8-20020a92c548000000b00368efa4bdf4mr6241902ilj.19.1711864386628; 
 Sat, 30 Mar 2024 22:53:06 -0700 (PDT)
Received: from smtpclient.apple ([2601:641:300:4910:a0c7:e3e9:cfdc:38fe])
 by smtp.gmail.com with ESMTPSA id
 f17-20020a170902ce9100b001e0e977f655sm6173016plg.159.2024.03.30.22.53.05
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 30 Mar 2024 22:53:06 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\))
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <86wmpldyve.fsf@HIDDEN>
Date: Sat, 30 Mar 2024 22:52:55 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <92195FEF-E940-41F7-B1A8-EC1607D9473E@HIDDEN>
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
 <87il15wbtx.fsf@HIDDEN> <86zfuhe0uo.fsf@HIDDEN> <878r218e1s.fsf@HIDDEN>
 <86wmpldyve.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3731.700.6)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 70059
Cc: Felix <felix.dick@HIDDEN>, 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Mar 29, 2024, at 5:08 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
>=20
>> From: Felix <felix.dick@HIDDEN>
>> Cc: Yuan Fu <casouri@HIDDEN>,  70059 <at> debbugs.gnu.org
>> Date: Fri, 29 Mar 2024 12:37:03 +0100
>>=20
>> Eli Zaretskii <eliz@HIDDEN> writes:
>>=20
>>>> From: Felix <felix.dick@HIDDEN>
>>>> Cc: Andrea Corallo <acorallo@HIDDEN>,  70059 <at> debbugs.gnu.org
>>>> Date: Fri, 29 Mar 2024 11:51:06 +0100
>>>>=20
>>>> I rebuild it without native-compilation, and it still crashes.
>>>> Backtrace:
>>>>=20
>>>> #0  0x000077b79c65c32c in ??? () at /usr/lib/libc.so.6
>>>> #1  0x000077b79c60b6c8 in raise () at /usr/lib/libc.so.6
>>>> #2  0x00005a5a428f94a2 in terminate_due_to_signal ()
>>>> #3  0x00005a5a42933c23 in emacs_abort ()
>>>> #4  0x00005a5a429ec268 in signal_or_quit ()
>>>> #5  0x00005a5a429eb422 in Fsignal ()
>>>> #6  0x00005a5a429eb401 in xsignal ()
>>>> #7  0x00005a5a429e9aa2 in xsignal2 ()
>>>> #8  0x00005a5a429c0865 in wrong_type_argument ()
>>>> #9  0x00005a5a42965e1f in Fexpand_file_name ()
>>>> #10 0x00005a5a42b3d200 in Fdo_auto_save.7873 ()
>>>> #11 0x00005a5a428f9738 in shut_down_emacs ()
>>>> #12 0x00005a5a428f946a in terminate_due_to_signal ()
>>>> #13 0x00005a5a42935924 in handle_sigsegv ()
>>>> #14 0x000077b79c60b770 in <signal handler called> () at =
/usr/lib/libc.so.6
>>>> #15 0x00005a5a429a57f6 in process_mark_stack ()
>>>> #16 0x00005a5a429a677b in mark_char_table ()
>>>> #17 0x00005a5a429a68c6 in mark_char_table ()
>>>> #18 0x00005a5a429a55bd in process_mark_stack ()
>>>> #19 0x00005a5a429a677b in mark_char_table ()
>>>> #20 0x00005a5a429a68c6 in mark_char_table ()
>>>> #21 0x00005a5a429a55bd in process_mark_stack ()
>>>> #22 0x00005a5a429a677b in mark_char_table ()
>>>> #23 0x00005a5a429a68c6 in mark_char_table ()
>>>> #24 0x00005a5a429a55bd in process_mark_stack ()
>>>> #25 0x00005a5a429a677b in mark_char_table ()
>>>> #26 0x00005a5a429a68c6 in mark_char_table ()
>>>> #27 0x00005a5a429a55bd in process_mark_stack ()
>>>> #28 0x00005a5a429a569b in process_mark_stack ()
>>>> #29 0x00005a5a429a569b in process_mark_stack ()
>>>> #30 0x00005a5a429a569b in process_mark_stack ()
>>>> #31 0x00005a5a429a7b8e in garbage_collect ()
>>>> #32 0x00005a5a429e76e7 in Ffuncall ()
>>>> #33 0x00005a5a42a094f7 in mapcar1 ()
>>>> #34 0x00005a5a42a091bf in Fmapconcat ()
>>>> #35 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
>>>> #36 0x00005a5a429e87b3 in funcall_subr ()
>>>> #37 0x00005a5a429e77f6 in Ffuncall ()
>>>> #38 0x00005a5a42a094f7 in mapcar1 ()
>>>> #39 0x00005a5a42a091bf in Fmapconcat ()
>>>> #40 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
>>>> #41 0x00005a5a429e87b3 in funcall_subr ()
>>>> #42 0x00005a5a429e77f6 in Ffuncall ()
>>>> #43 0x00005a5a42a094f7 in mapcar1 ()
>>>> #44 0x00005a5a42a091bf in Fmapconcat ()
>>>> #45 0x00005a5a42aca243 in treesit_ensure_query_compiled ()
>>>> #46 0x00005a5a42aca5c0 in Ftreesit_query_capture ()
>>>=20
>>> Then it's strange, since it doesn't happen here.  Does it happen for
>>> you with any C source file, including those in the Emacs source =
tree?
>>> If this happens only for some files, can you post one such file?
>>>=20
>>> Also, what version of the tree-sitter library are you using, and =
what
>>> version of the C grammar library?
>>>=20
>>> If you can build the emacs-29 branch, can you try reproducing there?
>>>=20
>>> Yuan, any ideas, based on the backtrace?
>>=20
>> I was using tree-sitter build from the git repository, when i use it
>> from the official arch linux repos, it doesn't crash (at least until
>> now).
>> I think this is tree-sitter related, but it shouldn't be able to =
crash
>> emacs, should it?
>=20
> It shouldn't, unless there's some memory-related snafu (which could
> explain why the crash is always in GC).  I hope Yuan will be able to
> tell.

It=E2=80=99s a bit strange since Ftreesit_pattern_expand doesn=E2=80=99t =
call tree-sitter function. This function just expands a sexp query like =
'(function_definition @capture) to a string =E2=80=9C(function_definition =
@capture)=E2=80=9D.=20

Perhaps something it does triggers GC and GC tries to collect some =
tree-sitter node or parser, and there=E2=80=99s some problem when =
freeing the node or parser with that version of tree-sitter library.

Also, I couldn=E2=80=99t reproduce with upstream tree-sitter plus emacs =
master either. I=E2=80=99m using commit =
0b4403294981ffb6a51d153a5509a389b91fed86 for tree-sitter and commit =
411f46fd365bc0008c58e1fa6bee6a60d841da75 for emacs. Felix, what commit =
are you using?

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 30 Mar 2024 14:29:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 30 10:29:47 2024
Received: from localhost ([127.0.0.1]:45957 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqZiN-0003V6-3C
	for submit <at> debbugs.gnu.org; Sat, 30 Mar 2024 10:29:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:37630)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acorallo@HIDDEN>) id 1rqZiM-0003Ut-AG
 for 70059 <at> debbugs.gnu.org; Sat, 30 Mar 2024 10:29:46 -0400
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 <acorallo@HIDDEN>)
 id 1rqZiE-0003ls-O0; Sat, 30 Mar 2024 10:29:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=kZfZk+4LsTsNBlTKBb5Qi1ShTzngLzzKBODS5P/HkY0=; b=TMXG1S6tvQEPaE4H3F0j
 vreUGmltF/b4eTso5tZ+4jsavsom31Jqb2YMaWreRYHIWzvvWurkRG80B+NojXaPSh/VfGqT1zQYg
 h/cXh4zlyWJpD8522dT86l2k06aG+NxSdAf4k2hGBYbei/4GBt2PWvqyMvOpKQvQmmEhQ8mbFvWbo
 Qx8GKc63YvG1dkacxOoQ6q4g8K08RODK+w0RzKCpm0/6W14Sn2E7d/RLxK2Sj23yFm5oFA/WMQIuf
 aZEo2CHA6TWMOnMcZrm9P0UsyDUssfgicRG/Faf1/vdjczyftXQOdo6M+rLTg3C0sRZb5tWLLkLD1
 ItMimRnmJRC+og==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1rqZiE-0005mx-01; Sat, 30 Mar 2024 10:29:38 -0400
From: Andrea Corallo <acorallo@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
In-Reply-To: <878r218e1s.fsf@HIDDEN> (Felix via's message of "Fri, 29 Mar 2024
 12:37:03 +0100")
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
 <87il15wbtx.fsf@HIDDEN> <86zfuhe0uo.fsf@HIDDEN>
 <878r218e1s.fsf@HIDDEN>
Date: Sat, 30 Mar 2024 10:29:37 -0400
Message-ID: <yp14jcnpzce.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70059
Cc: Yuan Fu <casouri@HIDDEN>, Felix <felix.dick@HIDDEN>,
 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Felix via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@HIDDEN> writes:

> Eli Zaretskii <eliz@HIDDEN> writes:
>
>>> From: Felix <felix.dick@HIDDEN>
>>> Cc: Andrea Corallo <acorallo@HIDDEN>,  70059 <at> debbugs.gnu.org
>>> Date: Fri, 29 Mar 2024 11:51:06 +0100
>>>
>>> I rebuild it without native-compilation, and it still crashes.
>>> Backtrace:
>>>
>>> #0  0x000077b79c65c32c in ??? () at /usr/lib/libc.so.6
>>> #1  0x000077b79c60b6c8 in raise () at /usr/lib/libc.so.6
>>> #2  0x00005a5a428f94a2 in terminate_due_to_signal ()
>>> #3  0x00005a5a42933c23 in emacs_abort ()
>>> #4  0x00005a5a429ec268 in signal_or_quit ()
>>> #5  0x00005a5a429eb422 in Fsignal ()
>>> #6  0x00005a5a429eb401 in xsignal ()
>>> #7  0x00005a5a429e9aa2 in xsignal2 ()
>>> #8  0x00005a5a429c0865 in wrong_type_argument ()
>>> #9  0x00005a5a42965e1f in Fexpand_file_name ()
>>> #10 0x00005a5a42b3d200 in Fdo_auto_save.7873 ()
>>> #11 0x00005a5a428f9738 in shut_down_emacs ()
>>> #12 0x00005a5a428f946a in terminate_due_to_signal ()
>>> #13 0x00005a5a42935924 in handle_sigsegv ()
>>> #14 0x000077b79c60b770 in <signal handler called> () at /usr/lib/libc.so.6
>>> #15 0x00005a5a429a57f6 in process_mark_stack ()
>>> #16 0x00005a5a429a677b in mark_char_table ()
>>> #17 0x00005a5a429a68c6 in mark_char_table ()
>>> #18 0x00005a5a429a55bd in process_mark_stack ()
>>> #19 0x00005a5a429a677b in mark_char_table ()
>>> #20 0x00005a5a429a68c6 in mark_char_table ()
>>> #21 0x00005a5a429a55bd in process_mark_stack ()
>>> #22 0x00005a5a429a677b in mark_char_table ()
>>> #23 0x00005a5a429a68c6 in mark_char_table ()
>>> #24 0x00005a5a429a55bd in process_mark_stack ()
>>> #25 0x00005a5a429a677b in mark_char_table ()
>>> #26 0x00005a5a429a68c6 in mark_char_table ()
>>> #27 0x00005a5a429a55bd in process_mark_stack ()
>>> #28 0x00005a5a429a569b in process_mark_stack ()
>>> #29 0x00005a5a429a569b in process_mark_stack ()
>>> #30 0x00005a5a429a569b in process_mark_stack ()
>>> #31 0x00005a5a429a7b8e in garbage_collect ()
>>> #32 0x00005a5a429e76e7 in Ffuncall ()
>>> #33 0x00005a5a42a094f7 in mapcar1 ()
>>> #34 0x00005a5a42a091bf in Fmapconcat ()
>>> #35 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
>>> #36 0x00005a5a429e87b3 in funcall_subr ()
>>> #37 0x00005a5a429e77f6 in Ffuncall ()
>>> #38 0x00005a5a42a094f7 in mapcar1 ()
>>> #39 0x00005a5a42a091bf in Fmapconcat ()
>>> #40 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
>>> #41 0x00005a5a429e87b3 in funcall_subr ()
>>> #42 0x00005a5a429e77f6 in Ffuncall ()
>>> #43 0x00005a5a42a094f7 in mapcar1 ()
>>> #44 0x00005a5a42a091bf in Fmapconcat ()
>>> #45 0x00005a5a42aca243 in treesit_ensure_query_compiled ()
>>> #46 0x00005a5a42aca5c0 in Ftreesit_query_capture ()
>>
>> Then it's strange, since it doesn't happen here.  Does it happen for
>> you with any C source file, including those in the Emacs source tree?
>> If this happens only for some files, can you post one such file?
>>
>> Also, what version of the tree-sitter library are you using, and what
>> version of the C grammar library?
>>
>> If you can build the emacs-29 branch, can you try reproducing there?
>>
>> Yuan, any ideas, based on the backtrace?
>
> I was using tree-sitter build from the git repository, when i use it
> from the official arch linux repos, it doesn't crash (at least until
> now).
> I think this is tree-sitter related, but it shouldn't be able to crash
> emacs, should it?

I should not but it could.

I used my distro's tree-sitter and could not reproduced.

  Andrea




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 30 Mar 2024 11:26:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 30 07:26:52 2024
Received: from localhost ([127.0.0.1]:44080 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqWrL-0007GL-W3
	for submit <at> debbugs.gnu.org; Sat, 30 Mar 2024 07:26:52 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45372)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acorallo@HIDDEN>) id 1rqWrI-0007G6-0y
 for 70059 <at> debbugs.gnu.org; Sat, 30 Mar 2024 07:26:51 -0400
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 <acorallo@HIDDEN>)
 id 1rqWrA-0003eB-Lq; Sat, 30 Mar 2024 07:26:40 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=JRpdma+XdfbWrLeSZKpTrmA/kWg7XXY9UEnpOizISNM=; b=Ci+mVupmYuKYGWmxO3rl
 pmPTaWC9U1QdBq/+DW/jHX/LARroj+lko5ary4hSqETRYq4MNPB3XyVDNNPHRMkxDzNtmdxtWSZ81
 Vk+ygPXhvDfinRZ0G3fJT9Z59tHyEIQU+N0UkgR8abMD7+C/1oJ44YYsZBt5K74vtL54V7fZ1U1b1
 JQSlpw/RHFJHZf3Rr0EWMZrspnwuGpMThtdqULCSCfVwP/NnqbkyqR20JotVhdVIik3NpbrwhcDJL
 o4Wty4PGiCyBqzt8lGu+M7Tnr+WDzDYZDgFe1papuK0Ph8fQovh12FOgvN8wLhLNHUepQVH60qhVX
 EYyRSfkbcMxQIA==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1rqWr8-00043p-SN; Sat, 30 Mar 2024 07:26:39 -0400
From: Andrea Corallo <acorallo@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
In-Reply-To: <86edbtfvge.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 29 Mar
 2024 08:39:13 +0300")
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
Date: Sat, 30 Mar 2024 07:26:38 -0400
Message-ID: <yp18r20ot8x.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70059
Cc: Felix <felix.dick@HIDDEN>, 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Thu, 28 Mar 2024 21:36:54 +0100
>> From:  Felix via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>> 
>> 
>> I can reproduce it like this:
>> run 'emacs -Q'
>> open a C source file.
>> M-x c-ts-mode
>> wait a few seconds, and emacs crashes.
>
> Doesn't happen here, but see below.
>
>> In GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version
>>  3.24.41, cairo version 1.18.0) of 2024-03-28
>> Repository revision: de9e913f9e2a1e01e5d091a553e98d75404a2246
>> Repository branch: makepkg
>                      ^^^^^^^
> What is this branch?  I don't see such a branch in the Emacs Git
> repository; did I miss something?  If this is your local branch, does
> it have any local changes which could affect this issue?
>
>> System Description: Arch Linux
>> 
>> Configured using:
>>  'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
>>  --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
>>  --with-modules --without-m17n-flt --without-gconf --enable-autodepend
>>  --enable-link-time-optimization --with-native-compilation=yes
>>  --with-xinput2 --with-pgtk --without-xaw3d --with-cairo-xcb
>>  --with-sound=no --with-xwidgets --with-tree-sitter --without-gpm
>>  --without-compress-install
>>  '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
>>  'CFLAGS=-march=native -mtune=generic -O3 -pipe -fno-plt -fexceptions
>>  -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
>>  -fstack-clash-protection -fcf-protection'
>>  LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
>> 
>> Configured features:
>> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
>> LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
>> PDUMPER PGTK PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
>> TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB
>
> I see your build is with native-compilation; mine is without.  The
> backtrace you posted:
>
>> #11 0x000062534cfba688 in shut_down_emacs ()
>> #12 0x000062534cfba3ba in terminate_due_to_signal ()
>> #13 0x000062534cff5be4 in handle_sigsegv ()
>> #14 0x0000723f608fd770 in <signal handler called> () at /usr/lib/libc.so.6
>> #15 0x000062534d063429 in process_mark_stack ()
>> #16 0x000062534d1649f1 in traverse_intervals_noorder ()
>> #17 0x000062534d063e5e in process_mark_stack ()
>> #18 0x000062534d063ceb in process_mark_stack ()
>> #19 0x000062534d063ceb in process_mark_stack ()
>> #20 0x000062534d064fab in mark_char_table ()
>> #21 0x000062534d0650f6 in mark_char_table ()
>> #22 0x000062534d063c0c in process_mark_stack ()
>> #23 0x000062534d063ceb in process_mark_stack ()
>> #24 0x000062534d063ceb in process_mark_stack ()
>> #25 0x000062534d063ceb in process_mark_stack ()
>> #26 0x000062534d0663be in garbage_collect ()
>> #27 0x000062534d11e30b in exec_byte_code ()
>> #28 0x000062534d0a5406 in Ffuncall ()
>> #29 0x000062534d0a58df in Fapply ()
>> #30 0x000062534d137961 in read_process_output_call ()
>> #31 0x000062534d0ae619 in internal_condition_case_1 ()
>> #32 0x000062534d137820 in exec_sentinel ()
>> #33 0x000062534d135d2f in status_notify ()
>> #34 0x000062534d13b00c in wait_reading_process_output ()
>
> indicates that Emacs crashed after some sub-process exited, the
> process sentinel was called, and that caused us to run some Lips and
> perform GC.  Any idea what that subprocess was? could it be the async
> native-compilation of some Lisp file?  Can you try building without
> native-compilation and see if the problem happens there as well?
>
> Also, do you see c-ts-mode's .eln file in your eln-cache directory?
>
> Andrea, can you try reproducing this?

Hi Eli,

here my datapoint, on current master (87be53846bf) compiled with native
compilation and tree sitter I can't reproduce this opening comp.c.

  Andrea





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 29 Mar 2024 12:08:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 08:08:33 2024
Received: from localhost ([127.0.0.1]:41854 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqB29-0005ef-0n
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 08:08:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57116)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rqB26-0005dx-6S
 for 70059 <at> debbugs.gnu.org; Fri, 29 Mar 2024 08:08:30 -0400
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 <eliz@HIDDEN>)
 id 1rqB1z-0001ur-JN; Fri, 29 Mar 2024 08:08:23 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=+5m7/+KzJyDalTAibresHl5KONBJZnJPt+vNGUjcYb8=; b=diKO3OHeUoSI
 Ma+6ZwnB9Vpet+HLuPMRl7IW1aFwgR+zpdzWc8+KekTdvSH10JDNjsEbrt7lgzixwGrzkVuXwsLeL
 lJ58SAddOQALeQTXHNTu4AN5ptmdI6OCRl8rMyVDczn7vTfehyW6cFfFzjgghmArs7OqFtVwq9OX+
 heHQAt85l1BlMajPUWY1y3j1UgOjoGrhoANUWsU23T4FZHIoA51VRhzEoOnGpOYeXZY3mUWKQ4RLj
 F9wZLVW52uLjsfG5PGeDodr+GCsIjqUpaBao+7bDZfVuONSMVza6L1xKCUlhtOhb7gJYCB2ZbENPg
 LRLEEXK5cn+okgqgMYJpPQ==;
Date: Fri, 29 Mar 2024 15:08:21 +0300
Message-Id: <86wmpldyve.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Felix <felix.dick@HIDDEN>
In-Reply-To: <878r218e1s.fsf@HIDDEN> (message from Felix on Fri, 29 Mar 2024
 12:37:03 +0100)
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
 <87il15wbtx.fsf@HIDDEN> <86zfuhe0uo.fsf@HIDDEN> <878r218e1s.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70059
Cc: casouri@HIDDEN, 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Felix <felix.dick@HIDDEN>
> Cc: Yuan Fu <casouri@HIDDEN>,  70059 <at> debbugs.gnu.org
> Date: Fri, 29 Mar 2024 12:37:03 +0100
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> From: Felix <felix.dick@HIDDEN>
> >> Cc: Andrea Corallo <acorallo@HIDDEN>,  70059 <at> debbugs.gnu.org
> >> Date: Fri, 29 Mar 2024 11:51:06 +0100
> >>
> >> I rebuild it without native-compilation, and it still crashes.
> >> Backtrace:
> >>
> >> #0  0x000077b79c65c32c in ??? () at /usr/lib/libc.so.6
> >> #1  0x000077b79c60b6c8 in raise () at /usr/lib/libc.so.6
> >> #2  0x00005a5a428f94a2 in terminate_due_to_signal ()
> >> #3  0x00005a5a42933c23 in emacs_abort ()
> >> #4  0x00005a5a429ec268 in signal_or_quit ()
> >> #5  0x00005a5a429eb422 in Fsignal ()
> >> #6  0x00005a5a429eb401 in xsignal ()
> >> #7  0x00005a5a429e9aa2 in xsignal2 ()
> >> #8  0x00005a5a429c0865 in wrong_type_argument ()
> >> #9  0x00005a5a42965e1f in Fexpand_file_name ()
> >> #10 0x00005a5a42b3d200 in Fdo_auto_save.7873 ()
> >> #11 0x00005a5a428f9738 in shut_down_emacs ()
> >> #12 0x00005a5a428f946a in terminate_due_to_signal ()
> >> #13 0x00005a5a42935924 in handle_sigsegv ()
> >> #14 0x000077b79c60b770 in <signal handler called> () at /usr/lib/libc.so.6
> >> #15 0x00005a5a429a57f6 in process_mark_stack ()
> >> #16 0x00005a5a429a677b in mark_char_table ()
> >> #17 0x00005a5a429a68c6 in mark_char_table ()
> >> #18 0x00005a5a429a55bd in process_mark_stack ()
> >> #19 0x00005a5a429a677b in mark_char_table ()
> >> #20 0x00005a5a429a68c6 in mark_char_table ()
> >> #21 0x00005a5a429a55bd in process_mark_stack ()
> >> #22 0x00005a5a429a677b in mark_char_table ()
> >> #23 0x00005a5a429a68c6 in mark_char_table ()
> >> #24 0x00005a5a429a55bd in process_mark_stack ()
> >> #25 0x00005a5a429a677b in mark_char_table ()
> >> #26 0x00005a5a429a68c6 in mark_char_table ()
> >> #27 0x00005a5a429a55bd in process_mark_stack ()
> >> #28 0x00005a5a429a569b in process_mark_stack ()
> >> #29 0x00005a5a429a569b in process_mark_stack ()
> >> #30 0x00005a5a429a569b in process_mark_stack ()
> >> #31 0x00005a5a429a7b8e in garbage_collect ()
> >> #32 0x00005a5a429e76e7 in Ffuncall ()
> >> #33 0x00005a5a42a094f7 in mapcar1 ()
> >> #34 0x00005a5a42a091bf in Fmapconcat ()
> >> #35 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
> >> #36 0x00005a5a429e87b3 in funcall_subr ()
> >> #37 0x00005a5a429e77f6 in Ffuncall ()
> >> #38 0x00005a5a42a094f7 in mapcar1 ()
> >> #39 0x00005a5a42a091bf in Fmapconcat ()
> >> #40 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
> >> #41 0x00005a5a429e87b3 in funcall_subr ()
> >> #42 0x00005a5a429e77f6 in Ffuncall ()
> >> #43 0x00005a5a42a094f7 in mapcar1 ()
> >> #44 0x00005a5a42a091bf in Fmapconcat ()
> >> #45 0x00005a5a42aca243 in treesit_ensure_query_compiled ()
> >> #46 0x00005a5a42aca5c0 in Ftreesit_query_capture ()
> >
> > Then it's strange, since it doesn't happen here.  Does it happen for
> > you with any C source file, including those in the Emacs source tree?
> > If this happens only for some files, can you post one such file?
> >
> > Also, what version of the tree-sitter library are you using, and what
> > version of the C grammar library?
> >
> > If you can build the emacs-29 branch, can you try reproducing there?
> >
> > Yuan, any ideas, based on the backtrace?
> 
> I was using tree-sitter build from the git repository, when i use it
> from the official arch linux repos, it doesn't crash (at least until
> now).
> I think this is tree-sitter related, but it shouldn't be able to crash
> emacs, should it?

It shouldn't, unless there's some memory-related snafu (which could
explain why the crash is always in GC).  I hope Yuan will be able to
tell.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 29 Mar 2024 11:37:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 07:37:15 2024
Received: from localhost ([127.0.0.1]:41805 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqAXr-000459-7r
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 07:37:15 -0400
Received: from mout.web.de ([212.227.15.14]:54697)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felix.dick@HIDDEN>) id 1rqAXo-00044t-Mq
 for 70059 <at> debbugs.gnu.org; Fri, 29 Mar 2024 07:37:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
 s=s29768273; t=1711712224; x=1712317024; i=felix.dick@HIDDEN;
 bh=Y4VYn72pxQRjRfEugFb+gSC/kRnzJ91BvFM78f+c+y4=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:
 Date;
 b=uRQNLIUs9ML9wJltokMD8f1IimpEvPy4Xw2oJanKgag8m6o//Zg2kBtBll+qJisS
 uQg1Q3rnQTPK7NA6++lWWImLtyLj+tFtVk0R4f5UaSnANENDAuVNQk7wtFpPJHav1
 AF3KkNL+m07+vDt0Vus9Z39A3oDQ9OqabFXjJBK/QG32VveAzMuKdxerKksEqOZKI
 7tbfyrtsQMDnN6U+X43jfbdlupNgwaf1wGPuJqDgy5ftREhFlOpy3fq6DXtp3aJco
 Tj8vhw4Rwa4IZgzfdbWIgGhc40Tq7iEByM5y07RQcXucDWfw85dV/P189hcOVApz4
 XiWfmUohX7zkuRm1aQ==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from felix-lifebooka531.web.de ([95.91.213.181]) by smtp.web.de
 (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id
 1MzCEB-1sl2Dz2goV-014DhL; Fri, 29 Mar 2024 12:37:04 +0100
From: Felix <felix.dick@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
In-Reply-To: <86zfuhe0uo.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 29 Mar
 2024 14:25:35 +0300")
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
 <87il15wbtx.fsf@HIDDEN> <86zfuhe0uo.fsf@HIDDEN>
User-Agent: mu4e 1.12.2; emacs 30.0.50
Date: Fri, 29 Mar 2024 12:37:03 +0100
Message-ID: <878r218e1s.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:von9bRH3Vhk2Riv3IRKJ2jfjWa0+CMkAu8eE4zagO4cbWGEOCZW
 OcsA6E8b3fJ33jaYUx77cFFMa4VO8i7qcKQPPqDDN8ERlt3nXyAFKnzizME0cYCAn1KrAum
 3QQyYmqNfCY6jD/71VLWgtXrT1ZYUtpEWMT8wMLbo4OTPNyrFjtSrh6FsOhi5/4UOPtGPsz
 c1t3UT4cyZco2Mzrzb53Q==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:aZMAhm6gdDM=;hQtreS+ArpetPAOYksih5zUUaul
 iJKeIigsYBQGABkZ9Elb0zOx2jYYnCGA+rOV2JQDaM19q0hfMeMoRI0CqSTMfaFE1Ir66Dteo
 grQ01y3e4N9+7mxgDMS2IpTcePwiP3Id1BHo3HsbW6XNlxjUOSxP2MKChK5gWh0tlTjYiD1Tb
 u4+PXavQkFLB85oVEQR6r2Rg8ENa+rg1778JndGyOmjcbAL9BkIxb9R6j6R/v+L3Uu9HQWOI2
 /zsIH72aZpAULcdntuMvkk985bWeP1Qcv/KI70Z0ZK6Zyg8mjSjz3y8mCQCLVLojItZGa91pc
 hgyhKuASTa0yibZ3FpsrJeiqS2RMWryxgZpXMiS5e579yTkOj8BDxGcxzTpW31nfdTWjVryiq
 gxW7w3AJyVTrC6vGsVSxe3/rr4pm98aZxC0kH3PjBikPmwIyiXXnGABnvi2S9KupoIoIZMXXC
 dGZq4xYONPccnzeD8M1u9CpNkyyIT5OFK+u1wpKsLMH52nEo6AdTNix+dL/2xq6KeNjeLA6BM
 r75JyC534P5Q5NE3ONw+d3ekS90Vmd+sAOTFt5q8k2VYOvu6Io/nn0XfZl2J/y7AW2Ys7ZJyM
 0r/TG6pcKFChl/P0ArZsJODmc+c/GiQwEcEvIuLlCq8nII13YcWyrgZbFOF+J6sYxePF2hTDl
 fmaTrOr9ANHSV6VTrTWxeelWKx5OVlyOpsgQnDScEd9kDTZZJsHWjKn8u1wwWKNndvxpFdUcp
 Jxym6Q3FXlqtKWAFSVblhoR0i3TmnDvKpRVaJ9HsKTv7MEYIH4PUUaaS48jzCQTMUTH3Cz+a/
 CfDQAhE5466uRVapabsc5UVihMGOp7sSUA1+Xt6weaGEk=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 70059
Cc: Yuan Fu <casouri@HIDDEN>, 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Felix <felix.dick@HIDDEN>
>> Cc: Andrea Corallo <acorallo@HIDDEN>,  70059 <at> debbugs.gnu.org
>> Date: Fri, 29 Mar 2024 11:51:06 +0100
>>
>> I rebuild it without native-compilation, and it still crashes.
>> Backtrace:
>>
>> #0  0x000077b79c65c32c in ??? () at /usr/lib/libc.so.6
>> #1  0x000077b79c60b6c8 in raise () at /usr/lib/libc.so.6
>> #2  0x00005a5a428f94a2 in terminate_due_to_signal ()
>> #3  0x00005a5a42933c23 in emacs_abort ()
>> #4  0x00005a5a429ec268 in signal_or_quit ()
>> #5  0x00005a5a429eb422 in Fsignal ()
>> #6  0x00005a5a429eb401 in xsignal ()
>> #7  0x00005a5a429e9aa2 in xsignal2 ()
>> #8  0x00005a5a429c0865 in wrong_type_argument ()
>> #9  0x00005a5a42965e1f in Fexpand_file_name ()
>> #10 0x00005a5a42b3d200 in Fdo_auto_save.7873 ()
>> #11 0x00005a5a428f9738 in shut_down_emacs ()
>> #12 0x00005a5a428f946a in terminate_due_to_signal ()
>> #13 0x00005a5a42935924 in handle_sigsegv ()
>> #14 0x000077b79c60b770 in <signal handler called> () at /usr/lib/libc.so.6
>> #15 0x00005a5a429a57f6 in process_mark_stack ()
>> #16 0x00005a5a429a677b in mark_char_table ()
>> #17 0x00005a5a429a68c6 in mark_char_table ()
>> #18 0x00005a5a429a55bd in process_mark_stack ()
>> #19 0x00005a5a429a677b in mark_char_table ()
>> #20 0x00005a5a429a68c6 in mark_char_table ()
>> #21 0x00005a5a429a55bd in process_mark_stack ()
>> #22 0x00005a5a429a677b in mark_char_table ()
>> #23 0x00005a5a429a68c6 in mark_char_table ()
>> #24 0x00005a5a429a55bd in process_mark_stack ()
>> #25 0x00005a5a429a677b in mark_char_table ()
>> #26 0x00005a5a429a68c6 in mark_char_table ()
>> #27 0x00005a5a429a55bd in process_mark_stack ()
>> #28 0x00005a5a429a569b in process_mark_stack ()
>> #29 0x00005a5a429a569b in process_mark_stack ()
>> #30 0x00005a5a429a569b in process_mark_stack ()
>> #31 0x00005a5a429a7b8e in garbage_collect ()
>> #32 0x00005a5a429e76e7 in Ffuncall ()
>> #33 0x00005a5a42a094f7 in mapcar1 ()
>> #34 0x00005a5a42a091bf in Fmapconcat ()
>> #35 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
>> #36 0x00005a5a429e87b3 in funcall_subr ()
>> #37 0x00005a5a429e77f6 in Ffuncall ()
>> #38 0x00005a5a42a094f7 in mapcar1 ()
>> #39 0x00005a5a42a091bf in Fmapconcat ()
>> #40 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
>> #41 0x00005a5a429e87b3 in funcall_subr ()
>> #42 0x00005a5a429e77f6 in Ffuncall ()
>> #43 0x00005a5a42a094f7 in mapcar1 ()
>> #44 0x00005a5a42a091bf in Fmapconcat ()
>> #45 0x00005a5a42aca243 in treesit_ensure_query_compiled ()
>> #46 0x00005a5a42aca5c0 in Ftreesit_query_capture ()
>
> Then it's strange, since it doesn't happen here.  Does it happen for
> you with any C source file, including those in the Emacs source tree?
> If this happens only for some files, can you post one such file?
>
> Also, what version of the tree-sitter library are you using, and what
> version of the C grammar library?
>
> If you can build the emacs-29 branch, can you try reproducing there?
>
> Yuan, any ideas, based on the backtrace?

I was using tree-sitter build from the git repository, when i use it
from the official arch linux repos, it doesn't crash (at least until
now).
I think this is tree-sitter related, but it shouldn't be able to crash
emacs, should it?
Depending on the answer this report could be closed.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 29 Mar 2024 11:25:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 07:25:50 2024
Received: from localhost ([127.0.0.1]:41789 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rqAMo-0000kL-6f
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 07:25:50 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:60592)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rqAMk-0000jT-Tp
 for 70059 <at> debbugs.gnu.org; Fri, 29 Mar 2024 07:25:49 -0400
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 <eliz@HIDDEN>)
 id 1rqAMe-0001c7-0T; Fri, 29 Mar 2024 07:25:40 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=w3EQf1tfm6CeHDbyOQhpY2u3lnN2grvLGbxX7rHbfJc=; b=NcwwGMM6PFZ5
 b2cdVVTqkh6x7/gmWIh0e+FIMPQi9x7toqi9OwGV+n1DEqGdLN9M0sTopLM15MTzQ4HcTiCyUV1P+
 F2MeijltA0abkBVvvZb1UM/xbf/ViiPv1RBLYWmLfZXLDEyuqhY2Ovw8UacvX65xU2E2H5cy7iNAQ
 iumkNzO0bVoNuo40rOjHvDAj1IPuygewNhd/uIBOSSrqsca8o9vJSlAInEB/daQ1ptuosd0I2ESuB
 890zQjg4NsianKCGASPvwfmmG4uzXnS5DCgOlieoArmS4gUyxMxdAPIFyuGTfFZQJ8s3W/37TT8Xb
 S9jQyoS35dVFtGjdFijKjA==;
Date: Fri, 29 Mar 2024 14:25:35 +0300
Message-Id: <86zfuhe0uo.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Felix <felix.dick@HIDDEN>, Yuan Fu <casouri@HIDDEN>
In-Reply-To: <87il15wbtx.fsf@HIDDEN> (message from Felix on Fri, 29 Mar 2024
 11:51:06 +0100)
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
 <87il15wbtx.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70059
Cc: 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Felix <felix.dick@HIDDEN>
> Cc: Andrea Corallo <acorallo@HIDDEN>,  70059 <at> debbugs.gnu.org
> Date: Fri, 29 Mar 2024 11:51:06 +0100
> 
> I rebuild it without native-compilation, and it still crashes.
> Backtrace:
> 
> #0  0x000077b79c65c32c in ??? () at /usr/lib/libc.so.6
> #1  0x000077b79c60b6c8 in raise () at /usr/lib/libc.so.6
> #2  0x00005a5a428f94a2 in terminate_due_to_signal ()
> #3  0x00005a5a42933c23 in emacs_abort ()
> #4  0x00005a5a429ec268 in signal_or_quit ()
> #5  0x00005a5a429eb422 in Fsignal ()
> #6  0x00005a5a429eb401 in xsignal ()
> #7  0x00005a5a429e9aa2 in xsignal2 ()
> #8  0x00005a5a429c0865 in wrong_type_argument ()
> #9  0x00005a5a42965e1f in Fexpand_file_name ()
> #10 0x00005a5a42b3d200 in Fdo_auto_save.7873 ()
> #11 0x00005a5a428f9738 in shut_down_emacs ()
> #12 0x00005a5a428f946a in terminate_due_to_signal ()
> #13 0x00005a5a42935924 in handle_sigsegv ()
> #14 0x000077b79c60b770 in <signal handler called> () at /usr/lib/libc.so.6
> #15 0x00005a5a429a57f6 in process_mark_stack ()
> #16 0x00005a5a429a677b in mark_char_table ()
> #17 0x00005a5a429a68c6 in mark_char_table ()
> #18 0x00005a5a429a55bd in process_mark_stack ()
> #19 0x00005a5a429a677b in mark_char_table ()
> #20 0x00005a5a429a68c6 in mark_char_table ()
> #21 0x00005a5a429a55bd in process_mark_stack ()
> #22 0x00005a5a429a677b in mark_char_table ()
> #23 0x00005a5a429a68c6 in mark_char_table ()
> #24 0x00005a5a429a55bd in process_mark_stack ()
> #25 0x00005a5a429a677b in mark_char_table ()
> #26 0x00005a5a429a68c6 in mark_char_table ()
> #27 0x00005a5a429a55bd in process_mark_stack ()
> #28 0x00005a5a429a569b in process_mark_stack ()
> #29 0x00005a5a429a569b in process_mark_stack ()
> #30 0x00005a5a429a569b in process_mark_stack ()
> #31 0x00005a5a429a7b8e in garbage_collect ()
> #32 0x00005a5a429e76e7 in Ffuncall ()
> #33 0x00005a5a42a094f7 in mapcar1 ()
> #34 0x00005a5a42a091bf in Fmapconcat ()
> #35 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
> #36 0x00005a5a429e87b3 in funcall_subr ()
> #37 0x00005a5a429e77f6 in Ffuncall ()
> #38 0x00005a5a42a094f7 in mapcar1 ()
> #39 0x00005a5a42a091bf in Fmapconcat ()
> #40 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
> #41 0x00005a5a429e87b3 in funcall_subr ()
> #42 0x00005a5a429e77f6 in Ffuncall ()
> #43 0x00005a5a42a094f7 in mapcar1 ()
> #44 0x00005a5a42a091bf in Fmapconcat ()
> #45 0x00005a5a42aca243 in treesit_ensure_query_compiled ()
> #46 0x00005a5a42aca5c0 in Ftreesit_query_capture ()

Then it's strange, since it doesn't happen here.  Does it happen for
you with any C source file, including those in the Emacs source tree?
If this happens only for some files, can you post one such file?

Also, what version of the tree-sitter library are you using, and what
version of the C grammar library?

If you can build the emacs-29 branch, can you try reproducing there?

Yuan, any ideas, based on the backtrace?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 29 Mar 2024 10:51:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 06:51:21 2024
Received: from localhost ([127.0.0.1]:41774 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rq9pQ-0007pw-CK
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 06:51:20 -0400
Received: from mout.web.de ([212.227.17.12]:49007)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felix.dick@HIDDEN>) id 1rq9pL-0007p5-03
 for 70059 <at> debbugs.gnu.org; Fri, 29 Mar 2024 06:51:19 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
 s=s29768273; t=1711709467; x=1712314267; i=felix.dick@HIDDEN;
 bh=dBr2dC43ouE6E/WxwRUPrgQZ4i+eBNTYC3Bkpl76cy4=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:
 Date;
 b=cDBU6o1aJGnysdbdcA7n2sGelP7jZ1tEKfcnzY9fKgBK6zvF0Sm8kXZHMJl81hWp
 RqYwQFrVyBFDPAFaQI9V9u7JH4uZ+NDfCV6Hg27CtZl9h6oCqeAp75ojGjDu1LG2j
 xWp5TpVM8Sod8LPn5ptKnh64B+JCfQuxLhyD9ZpReLu4o8PgRM3La3E8mmYpY+swG
 3qiOsiayl2026tcbiU9JRS/B04zkJVi9p/C9ltuXHgjADSZQcg06nAg38jYFW+Rxc
 IzWAv46Uk5QtLtdeGJDUl2QzfxfbNsn157UxRPpvKK29TzS1GcNkwuDsFTbJhTzBq
 B/MrA3FuDc+meJy6xg==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from felix-lifebooka531.web.de ([95.91.213.181]) by smtp.web.de
 (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id
 1MXXN7-1sLr401x6d-00YjOS; Fri, 29 Mar 2024 11:51:07 +0100
From: Felix <felix.dick@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
In-Reply-To: <86edbtfvge.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 29 Mar
 2024 08:39:13 +0300")
References: <877chmccux.fsf@HIDDEN> <86edbtfvge.fsf@HIDDEN>
User-Agent: mu4e 1.12.2; emacs 30.0.50
Date: Fri, 29 Mar 2024 11:51:06 +0100
Message-ID: <87il15wbtx.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:mhGzQpcJN80kZJa89WX9dHHSuwh4pHnSis1RsseL3H84MM/5q3P
 rRLcMUvoGael2fILbuBtPkfLY5tQQCV7uxQleoRi8pXn86m51Z3MqH50SISJPuepMjm5fz6
 4L3SJ03xAv36lNetRenI1mi+3UK8VAu92T5E5rQzP4d0otz33TsyvrvJhvCgrUHIEoQOe2M
 Q6arXSTiRSL63bZ5Kz3lw==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:xZx+szqSH50=;DvJ42ljIxfVA3GixMktBcVQZDAg
 Xjs/P/mSVoBNbB48AnzNr4jTK1YTtLZf2XoylShCYDsKUTragVsdc8qRn1SzVFJoEBqV/qz/g
 2SaBjCIXAurbv2oAByOUrHSbNJgbjh1XV2EEsY7LPwqFqBYehJS3lgEGgcMIgVwXRmcdeM6KF
 6/6DWp5LwFDPdZS4nuR6YvcOJGH93PVJ1db0YFGaiM6NzKScmWOqVTcVesr60wIXaYnhRTRPN
 ewP7+5CVJB9ub0OCtZc3TtIXAJ8ZgRIBYBefc2eNyOj7mQOL8oMw2+ox67yBSZ/OoS6FX0Hcx
 ehyD6BqhFGprHGRrt4lYL3he63CJKV3UX5t8X1ZvUhnKJ3YQYOAtPcQ1+X543NY6Lp183qxUg
 trtxfGW6t5DQt+rji1rin3jigkJREtpSIxYWuCbKRuG3Ggkli7jSdZvnqXcWqSpR6affKT6xA
 4wicyFBYpgUF72nWgENCYFLgS5MmPEqsgrzQCzAHpkxd8TqAKMMikjGqLhrn0MKqmL5Wy9qyw
 XoRJKvKFyB45vn3hFPHtwYzx6xUTQmSTsCkND10R0a8x1H/50y5sdpYWPBMBRoxmv4CR7+LiM
 NRf0hMSVXjsXFJAhqiXvDkc5bwF2cA+Knkvr5mb321Ne4NsYmhBt1oSMZ+W+QNlLJKguUOJee
 +o6z/6I4DOr22VuI8PbfJ9hNBjhNjS7RdXZ+BbsXgQb6nwWGcDMS1QZBwxGm5p+buOHdh1TK8
 4s9pNnrfNklLvPYVxfQIYnxN1onKp/4GYHp5gEPBEnjCE8wJ9aYnjuyOQKR6DSi9OAYRqxm44
 4PyHCcv4ZN7Y3TEwHXSx8nlRwtwGpbuuFUexmfr2VagnI=
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 70059
Cc: Andrea Corallo <acorallo@HIDDEN>, 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Thu, 28 Mar 2024 21:36:54 +0100
>> From:  Felix via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>
>>
>> I can reproduce it like this:
>> run 'emacs -Q'
>> open a C source file.
>> M-x c-ts-mode
>> wait a few seconds, and emacs crashes.
>
> Doesn't happen here, but see below.
>
>> In GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version
>>  3.24.41, cairo version 1.18.0) of 2024-03-28
>> Repository revision: de9e913f9e2a1e01e5d091a553e98d75404a2246
>> Repository branch: makepkg
>                      ^^^^^^^
> What is this branch?  I don't see such a branch in the Emacs Git
> repository; did I miss something?  If this is your local branch, does
> it have any local changes which could affect this issue?
>

I build emacs from the arch linux AUR, it's not differrent from the master branch


>> System Description: Arch Linux
>>
>> Configured using:
>>  'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
>>  --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
>>  --with-modules --without-m17n-flt --without-gconf --enable-autodepend
>>  --enable-link-time-optimization --with-native-compilation=yes
>>  --with-xinput2 --with-pgtk --without-xaw3d --with-cairo-xcb
>>  --with-sound=no --with-xwidgets --with-tree-sitter --without-gpm
>>  --without-compress-install
>>  '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
>>  'CFLAGS=-march=native -mtune=generic -O3 -pipe -fno-plt -fexceptions
>>  -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
>>  -fstack-clash-protection -fcf-protection'
>>  LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
>>
>> Configured features:
>> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
>> LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
>> PDUMPER PGTK PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
>> TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB
>
> I see your build is with native-compilation; mine is without.  The
> backtrace you posted:
>
>> #11 0x000062534cfba688 in shut_down_emacs ()
>> #12 0x000062534cfba3ba in terminate_due_to_signal ()
>> #13 0x000062534cff5be4 in handle_sigsegv ()
>> #14 0x0000723f608fd770 in <signal handler called> () at /usr/lib/libc.so.6
>> #15 0x000062534d063429 in process_mark_stack ()
>> #16 0x000062534d1649f1 in traverse_intervals_noorder ()
>> #17 0x000062534d063e5e in process_mark_stack ()
>> #18 0x000062534d063ceb in process_mark_stack ()
>> #19 0x000062534d063ceb in process_mark_stack ()
>> #20 0x000062534d064fab in mark_char_table ()
>> #21 0x000062534d0650f6 in mark_char_table ()
>> #22 0x000062534d063c0c in process_mark_stack ()
>> #23 0x000062534d063ceb in process_mark_stack ()
>> #24 0x000062534d063ceb in process_mark_stack ()
>> #25 0x000062534d063ceb in process_mark_stack ()
>> #26 0x000062534d0663be in garbage_collect ()
>> #27 0x000062534d11e30b in exec_byte_code ()
>> #28 0x000062534d0a5406 in Ffuncall ()
>> #29 0x000062534d0a58df in Fapply ()
>> #30 0x000062534d137961 in read_process_output_call ()
>> #31 0x000062534d0ae619 in internal_condition_case_1 ()
>> #32 0x000062534d137820 in exec_sentinel ()
>> #33 0x000062534d135d2f in status_notify ()
>> #34 0x000062534d13b00c in wait_reading_process_output ()



>
> indicates that Emacs crashed after some sub-process exited, the
> process sentinel was called, and that caused us to run some Lips and
> perform GC.  Any idea what that subprocess was? could it be the async
> native-compilation of some Lisp file?  Can you try building without
> native-compilation and see if the problem happens there as well?


I rebuild it without native-compilation, and it still crashes.
Backtrace:

#0  0x000077b79c65c32c in ??? () at /usr/lib/libc.so.6
#1  0x000077b79c60b6c8 in raise () at /usr/lib/libc.so.6
#2  0x00005a5a428f94a2 in terminate_due_to_signal ()
#3  0x00005a5a42933c23 in emacs_abort ()
#4  0x00005a5a429ec268 in signal_or_quit ()
#5  0x00005a5a429eb422 in Fsignal ()
#6  0x00005a5a429eb401 in xsignal ()
#7  0x00005a5a429e9aa2 in xsignal2 ()
#8  0x00005a5a429c0865 in wrong_type_argument ()
#9  0x00005a5a42965e1f in Fexpand_file_name ()
#10 0x00005a5a42b3d200 in Fdo_auto_save.7873 ()
#11 0x00005a5a428f9738 in shut_down_emacs ()
#12 0x00005a5a428f946a in terminate_due_to_signal ()
#13 0x00005a5a42935924 in handle_sigsegv ()
#14 0x000077b79c60b770 in <signal handler called> () at /usr/lib/libc.so.6
#15 0x00005a5a429a57f6 in process_mark_stack ()
#16 0x00005a5a429a677b in mark_char_table ()
#17 0x00005a5a429a68c6 in mark_char_table ()
#18 0x00005a5a429a55bd in process_mark_stack ()
#19 0x00005a5a429a677b in mark_char_table ()
#20 0x00005a5a429a68c6 in mark_char_table ()
#21 0x00005a5a429a55bd in process_mark_stack ()
#22 0x00005a5a429a677b in mark_char_table ()
#23 0x00005a5a429a68c6 in mark_char_table ()
#24 0x00005a5a429a55bd in process_mark_stack ()
#25 0x00005a5a429a677b in mark_char_table ()
#26 0x00005a5a429a68c6 in mark_char_table ()
#27 0x00005a5a429a55bd in process_mark_stack ()
#28 0x00005a5a429a569b in process_mark_stack ()
#29 0x00005a5a429a569b in process_mark_stack ()
#30 0x00005a5a429a569b in process_mark_stack ()
#31 0x00005a5a429a7b8e in garbage_collect ()
#32 0x00005a5a429e76e7 in Ffuncall ()
#33 0x00005a5a42a094f7 in mapcar1 ()
#34 0x00005a5a42a091bf in Fmapconcat ()
#35 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
#36 0x00005a5a429e87b3 in funcall_subr ()
#37 0x00005a5a429e77f6 in Ffuncall ()
#38 0x00005a5a42a094f7 in mapcar1 ()
#39 0x00005a5a42a091bf in Fmapconcat ()
#40 0x00005a5a42ac9d90 in Ftreesit_pattern_expand ()
#41 0x00005a5a429e87b3 in funcall_subr ()
#42 0x00005a5a429e77f6 in Ffuncall ()
#43 0x00005a5a42a094f7 in mapcar1 ()
#44 0x00005a5a42a091bf in Fmapconcat ()
#45 0x00005a5a42aca243 in treesit_ensure_query_compiled ()
#46 0x00005a5a42aca5c0 in Ftreesit_query_capture ()
#47 0x00005a5a429e880a in funcall_subr ()
#48 0x00005a5a42a606de in exec_byte_code ()
#49 0x00005a5a429e77f6 in Ffuncall ()
#50 0x00005a5a429f1f5c in Frun_hook_wrapped ()
#51 0x00005a5a42a606de in exec_byte_code ()
#52 0x00005a5a429e77f6 in Ffuncall ()
#53 0x00005a5a429f0ad7 in internal_condition_case_n ()
#54 0x00005a5a427f2ef7 in handle_stop ()
#55 0x00005a5a42803822 in start_display ()
#56 0x00005a5a4282b922 in try_window ()
#57 0x00005a5a42826f1a in redisplay_window ()
#58 0x00005a5a4283a927 in redisplay_window_0 ()
#59 0x00005a5a429f09b9 in internal_condition_case_1 ()
#60 0x00005a5a42821a55 in redisplay_windows ()
#61 0x00005a5a42819a36 in redisplay_internal ()
#62 0x00005a5a42907548 in read_char ()
#63 0x00005a5a42903deb in read_key_sequence ()
#64 0x00005a5a429019f9 in command_loop_1 ()
#65 0x00005a5a429f0937 in internal_condition_case ()
#66 0x00005a5a4290085e in command_loop_2 ()
#67 0x00005a5a429ef7f1 in internal_catch ()
#68 0x00005a5a4290080c in command_loop ()
#69 0x00005a5a42900676 in recursive_edit_1 ()
#70 0x00005a5a429178d7 in Frecursive_edit ()
#71 0x00005a5a428fe4fa in main ()
>
> Also, do you see c-ts-mode's .eln file in your eln-cache directory?

Yes it's there when emacs is compiled with native-compilation

>
> Andrea, can you try reproducing this?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at 70059 <at> debbugs.gnu.org:


Received: (at 70059) by debbugs.gnu.org; 29 Mar 2024 05:39:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 29 01:39:28 2024
Received: from localhost ([127.0.0.1]:41532 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rq4xb-0005pD-GA
	for submit <at> debbugs.gnu.org; Fri, 29 Mar 2024 01:39:27 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43674)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rq4xY-0005ot-S0
 for 70059 <at> debbugs.gnu.org; Fri, 29 Mar 2024 01:39:25 -0400
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 <eliz@HIDDEN>)
 id 1rq4xR-00014T-So; Fri, 29 Mar 2024 01:39:17 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=RUawmdIdUqJ5fZ3Oyu7nc1qZOaklpRomOqaA3GneVm8=; b=TWyO09k7XCxo
 5LVwrhSrF/KA7pljfvbOrD+KhKmB3a9B0YlgonuHRR+EW1C2OzLo+BsMISaN9+Xa+4UGIjXLnIkEu
 /q+Cb6dM7QPkBjNCSvWPzLoEpTfjpWmqFdpHnvh49Y0lSBPXQ/g3a2qh/zc3iMnvAIeQZJnsWfTe9
 F9qWtSHLyVxkeyF23CVvBEq/JoyKIZ1lV/bRIvJhHxkCmccuMyh7Py/1IvAqL5iDQO6AvuxVMIe30
 3+UiO8BelDPgFSHP+0H0O+NL25Y1/j4726Q4ka4GPqPnBfgFw1pIA+AsU4PITSr63aRyYfqmOKodw
 6QtI6SB9WoGvk9YZBu/dUw==;
Date: Fri, 29 Mar 2024 08:39:13 +0300
Message-Id: <86edbtfvge.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Felix <felix.dick@HIDDEN>, Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <877chmccux.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#70059: 30.0.50; c-ts-mode crashes emacs
References: <877chmccux.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70059
Cc: 70059 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Thu, 28 Mar 2024 21:36:54 +0100
> From:  Felix via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> 
> I can reproduce it like this:
> run 'emacs -Q'
> open a C source file.
> M-x c-ts-mode
> wait a few seconds, and emacs crashes.

Doesn't happen here, but see below.

> In GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version
>  3.24.41, cairo version 1.18.0) of 2024-03-28
> Repository revision: de9e913f9e2a1e01e5d091a553e98d75404a2246
> Repository branch: makepkg
                     ^^^^^^^
What is this branch?  I don't see such a branch in the Emacs Git
repository; did I miss something?  If this is your local branch, does
it have any local changes which could affect this issue?

> System Description: Arch Linux
> 
> Configured using:
>  'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
>  --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
>  --with-modules --without-m17n-flt --without-gconf --enable-autodepend
>  --enable-link-time-optimization --with-native-compilation=yes
>  --with-xinput2 --with-pgtk --without-xaw3d --with-cairo-xcb
>  --with-sound=no --with-xwidgets --with-tree-sitter --without-gpm
>  --without-compress-install
>  '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
>  'CFLAGS=-march=native -mtune=generic -O3 -pipe -fno-plt -fexceptions
>  -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
>  -fstack-clash-protection -fcf-protection'
>  LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
> 
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
> LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
> PDUMPER PGTK PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
> TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB

I see your build is with native-compilation; mine is without.  The
backtrace you posted:

> #11 0x000062534cfba688 in shut_down_emacs ()
> #12 0x000062534cfba3ba in terminate_due_to_signal ()
> #13 0x000062534cff5be4 in handle_sigsegv ()
> #14 0x0000723f608fd770 in <signal handler called> () at /usr/lib/libc.so.6
> #15 0x000062534d063429 in process_mark_stack ()
> #16 0x000062534d1649f1 in traverse_intervals_noorder ()
> #17 0x000062534d063e5e in process_mark_stack ()
> #18 0x000062534d063ceb in process_mark_stack ()
> #19 0x000062534d063ceb in process_mark_stack ()
> #20 0x000062534d064fab in mark_char_table ()
> #21 0x000062534d0650f6 in mark_char_table ()
> #22 0x000062534d063c0c in process_mark_stack ()
> #23 0x000062534d063ceb in process_mark_stack ()
> #24 0x000062534d063ceb in process_mark_stack ()
> #25 0x000062534d063ceb in process_mark_stack ()
> #26 0x000062534d0663be in garbage_collect ()
> #27 0x000062534d11e30b in exec_byte_code ()
> #28 0x000062534d0a5406 in Ffuncall ()
> #29 0x000062534d0a58df in Fapply ()
> #30 0x000062534d137961 in read_process_output_call ()
> #31 0x000062534d0ae619 in internal_condition_case_1 ()
> #32 0x000062534d137820 in exec_sentinel ()
> #33 0x000062534d135d2f in status_notify ()
> #34 0x000062534d13b00c in wait_reading_process_output ()

indicates that Emacs crashed after some sub-process exited, the
process sentinel was called, and that caused us to run some Lips and
perform GC.  Any idea what that subprocess was? could it be the async
native-compilation of some Lisp file?  Can you try building without
native-compilation and see if the problem happens there as well?

Also, do you see c-ts-mode's .eln file in your eln-cache directory?

Andrea, can you try reproducing this?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Mar 2024 20:37:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 28 16:37:20 2024
Received: from localhost ([127.0.0.1]:41218 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rpwUx-0003kQ-Qb
	for submit <at> debbugs.gnu.org; Thu, 28 Mar 2024 16:37:20 -0400
Received: from lists.gnu.org ([2001:470:142::17]:41016)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felix.dick@HIDDEN>) id 1rpwUt-0003jW-4a
 for submit <at> debbugs.gnu.org; Thu, 28 Mar 2024 16:37:17 -0400
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 <felix.dick@HIDDEN>) id 1rpwUm-0002w3-LF
 for bug-gnu-emacs@HIDDEN; Thu, 28 Mar 2024 16:37:08 -0400
Received: from mout.web.de ([212.227.17.11])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <felix.dick@HIDDEN>) id 1rpwUf-0007J9-5w
 for bug-gnu-emacs@HIDDEN; Thu, 28 Mar 2024 16:37:04 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
 s=s29768273; t=1711658215; x=1712263015; i=felix.dick@HIDDEN;
 bh=/LVGaoaH878rQpJ9WGV5cXHKkx1AQPtobw999+bNTnw=;
 h=X-UI-Sender-Class:From:To:Subject:Date;
 b=YuiTkqzggMf7KRWQpfaZWc0pbO7RRA9PPs3IctNuDp6gRH/2gQVgN3mRSJ8GF9RE
 uhYg9+678R1ebieBztMWRME0cRRYnhotZSaQde+8zsE4dwqFp5x/apPVYm+qpNx9u
 DQWRFwC6+SgUEmFeS4YSAEYqSuRE/TmNgPtGHNIkO9UQHq3WwJu7EZEPSgWJrT5P+
 8EIyQU/DSC67LVN7a0Cny7nPuxXN9p7X1YwLQQjSPXe3fMUrFe9uQXde9t128Y3CG
 vhu3t1F7tCYDqJlvyUbtHdn/KhxkwqJqnYOYplK3o7ZTmrmKvCYXVsBZ52SYltrE+
 daHjP+Tq9lcsx/mdNw==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from felix-lifebooka531.web.de ([95.91.244.227]) by smtp.web.de
 (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id
 1MRk0W-1sJ4Bh22d0-00TC2q for <bug-gnu-emacs@HIDDEN>; Thu, 28 Mar 2024
 21:36:55 +0100
From: Felix <felix.dick@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.50; c-ts-mode crashes emacs
X-Debbugs-Cc: 
Date: Thu, 28 Mar 2024 21:36:54 +0100
Message-ID: <877chmccux.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:uqllBIffHxNoh3fo62bPXkDQnjutttD+H7SqdcDnnMb3LvYrVSn
 CGKt3OeJ4/T+wZ+xYBZvRtFUlgZxKXyDuknn4RGo3gnqx7ZQM4eOYQNxAqxKRvDHyMKL0kO
 E8dIGWALnKIrc8HYQJ9JGzfvGssq5pVoyU31mLprk2Co2TyYi30Kj8Bsdpw5UxRZkUnocWY
 2i1AHr7MoaCL87mwsFPTA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:xTSwYA/C8PI=;aOaojOEf84UmxVcqwgGEC2ui+zo
 SCgmiQS7XLdOyfLfsEPJsze7pNyXsu83XCYwFC9dkEntYbp7hzNl27qdDyzNQWHE3wKaCUQvd
 QBHLoyGxCBOYfmoS4DWuk0owgqUFpz3Pwl+bL6CLHOD1oRBMoNYruLbWxfN/mUGpKoIG4pm5t
 m8zrAV2deqFtrrDYFN05cj3xbkM09IdDqxodZP1a7IiNUP5IL75gr5dRu8+4dGw6xlLiy2gE6
 Ur2nLnK0CLH5xl7eVmAifjzjjms05h5Rg5s9x20RlJHCo2hlhM3ZN6VCrgSia26vaFZ7GFxVh
 nHxEptEm+2pJdTQoo6m/k6aZN6fooY5AxPeyvWcA3LaLX63AUChvM1OEZTJB6N6PgUFMvMCWx
 vLT2mFexNV61fXtIs7ObnhEUZfcjX3Mjx/PZf2Ye9eDdr0DV878mSftrzh/WrpSb1Vqiq4s4g
 PcSYt6NtmT3lB3Z5wmIEyRgyrrfW/kKdBaAOXTLukXHbWqgdu8h+lfJNqQS+XTLmbN9GoquHN
 NCmWSc0oygSJ5k1AfPL5kz/pyAwcoG21q+OBrkDwbareuk5l/4fJAQOp66IOpiUsBtjyB7PCZ
 ibAt++yq5h/m1O1Zo1tSYSDF4OPkA3vrnmTPgTneVLRc+/XvEqUQL9VLDBI0pimBcw0NOnUAr
 qn+91rSUrvL4fcEtM1ntX/VWkK+v10ce2Afh3VZoZ5VSmhnl1jXKI2Nv2lcloSjkXVfym5j3T
 /rtKox8XtJ6W1uHq/ucRUbbto7oPzNUQOW9twE8EN0cc+R1msWOD/9qsXh1xYDVcA1C5C/P/s
 s35kGq/np1ysQXBIa6pk91VG9XCKHD1x3ta62fdT9ep+E=
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=212.227.17.11; envelope-from=felix.dick@HIDDEN;
 helo=mout.web.de
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


I can reproduce it like this:
run 'emacs -Q'
open a C source file.
M-x c-ts-mode
wait a few seconds, and emacs crashes.


In GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2024-03-28
Repository revision: de9e913f9e2a1e01e5d091a553e98d75404a2246
Repository branch: makepkg
System Description: Arch Linux

Configured using:
 'configure --prefix=3D/usr --sysconfdir=3D/etc --libexecdir=3D/usr/lib
 --localstatedir=3D/var --mandir=3D/usr/share/man --with-gameuser=3D:games
 --with-modules --without-m17n-flt --without-gconf --enable-autodepend
 --enable-link-time-optimization --with-native-compilation=3Dyes
 --with-xinput2 --with-pgtk --without-xaw3d --with-cairo-xcb
 --with-sound=3Dno --with-xwidgets --with-tree-sitter --without-gpm
 --without-compress-install
 '--program-transform-name=3Ds/\([ec]tags\)/\1.emacs/'
 'CFLAGS=3D-march=3Dnative -mtune=3Dgeneric -O3 -pipe -fno-plt -fexception=
s
 -Wp,-D_FORTIFY_SOURCE=3D2 -Wformat -Werror=3Dformat-security
 -fstack-clash-protection -fcf-protection'
 LDFLAGS=3D-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8


output of 'bt full':
#0  0x0000723f6094e32c in ??? () at /usr/lib/libc.so.6
#1  0x0000723f608fd6c8 in raise () at /usr/lib/libc.so.6
#2  0x000062534cfba3f2 in terminate_due_to_signal ()
#3  0x000062534cff3ee3 in emacs_abort ()
#4  0x000062534d0a9ec8 in signal_or_quit ()
#5  0x000062534d0a9082 in Fsignal ()
#6  0x000062534d0a9061 in xsignal ()
#7  0x000062534d0a76f2 in xsignal2 ()
#8  0x000062534d080376 in wrong_type_argument ()
#9  0x000062534d02578f in Fexpand_file_name ()
#10 0x000062534d208d00 in Fdo_auto_save.8209 ()
#11 0x000062534cfba688 in shut_down_emacs ()
#12 0x000062534cfba3ba in terminate_due_to_signal ()
#13 0x000062534cff5be4 in handle_sigsegv ()
#14 0x0000723f608fd770 in <signal handler called> () at /usr/lib/libc.so.6
#15 0x000062534d063429 in process_mark_stack ()
#16 0x000062534d1649f1 in traverse_intervals_noorder ()
#17 0x000062534d063e5e in process_mark_stack ()
#18 0x000062534d063ceb in process_mark_stack ()
#19 0x000062534d063ceb in process_mark_stack ()
#20 0x000062534d064fab in mark_char_table ()
#21 0x000062534d0650f6 in mark_char_table ()
#22 0x000062534d063c0c in process_mark_stack ()
#23 0x000062534d063ceb in process_mark_stack ()
#24 0x000062534d063ceb in process_mark_stack ()
#25 0x000062534d063ceb in process_mark_stack ()
#26 0x000062534d0663be in garbage_collect ()
#27 0x000062534d11e30b in exec_byte_code ()
#28 0x000062534d0a5406 in Ffuncall ()
#29 0x000062534d0a58df in Fapply ()
#30 0x000062534d137961 in read_process_output_call ()
#31 0x000062534d0ae619 in internal_condition_case_1 ()
#32 0x000062534d137820 in exec_sentinel ()
#33 0x000062534d135d2f in status_notify ()
#34 0x000062534d13b00c in wait_reading_process_output ()
#35 0x000062534cfce3bf in kbd_buffer_get_event ()
#36 0x000062534cfca560 in read_char ()
#37 0x000062534cfc4c1b in read_key_sequence ()
#38 0x000062534cfc2829 in command_loop_1 ()
#39 0x000062534d0ae597 in internal_condition_case ()
#40 0x000062534cfc168e in command_loop_2 ()
#41 0x000062534d0ad451 in internal_catch ()
#42 0x000062534cfc163c in command_loop ()
#43 0x000062534cfc14a6 in recursive_edit_1 ()
#44 0x000062534cfd8707 in Frecursive_edit ()
#45 0x000062534cfbf419 in main ()





Acknowledgement sent to Felix <felix.dick@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#70059; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 2 Apr 2024 18:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.