GNU bug report logs - #71012
30.0.50; tree-sitter crash

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Fri, 17 May 2024 13:40:01 UTC

Severity: normal

Found in version 30.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71012 <at> debbugs.gnu.org, Helmut Eller <eller.helmut <at> gmail.com>
Subject: bug#71012: 30.0.50; tree-sitter crash
Date: Tue, 28 May 2024 22:15:05 -0700

> On May 27, 2024, at 3:10 PM, Yuan Fu <casouri <at> gmail.com> wrote:
> 
> 
> 
>> On May 17, 2024, at 11:07 PM, Yuan Fu <casouri <at> gmail.com> wrote:
>> 
>> 
>> 
>>> On May 17, 2024, at 8:29 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>>> 
>>>> From: Helmut Eller <eller.helmut <at> gmail.com>
>>>> Date: Fri, 17 May 2024 15:39:27 +0200
>>>> 
>>>> The code in the attached file tries to parse src/lisp.h but crashes
>>>> while printing the result:  emacs --batch -l ts-bug.el
>>> 
>>> Yuan, can you help, please?
>>> 
>>> Btw, why do you use treesit-parse-string?  The Emacs integration with
>>> tree-sitter can parse a buffer without making a string from its
>>> contents.
>> 
>> Yep, I’ll look into it.
>> 
>> Yuan
> 
> Just an update, I didn’t forget about this. If I didn’t reply back today, I will in a few days :-)
> 
> Yuan

From what I can gather, the crash seems to be because the temp buffer is garbage collected—the inserted lisp.h is a large file, so the temp buffer is probably immediately collected, before Emacs tries to print the node in the next line. I replaced the insert-file-content with some smaller file and it didn’t crash.

But that theory has critical flaws: a) Emacs certainly doesn't collect the temp buffer before the with-temp-buffer form returns; b) I can’t crash Emacs in my non-debug build by inserting (garbage-collect) in front of the message line in the example; c) debug build Emacs still crashes even if I enlarge gc-cons-threshold.

Eli, is there anything different regarding temp buffers in debug builds?

Yuan





This bug report was last modified 323 days ago.

Previous Next


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