Subject: Re: bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node

From: Mickey Petersen <[email-masked]>
Date: Thu, 29 Dec 2022 14:21:35 +0000

Yuan Fu <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> writes:
>
>>> From: Mickey Petersen <[email-masked]>
>>> Date: Wed, 21 Dec 2022 12:24:34 +0000
>>
>> Yuan, can you look into this?  The crash is in tree-sitter, so maybe
>> it isn't our bug, but I'd like to be sure.  And even if it is a
>> tree-sitter bug, maybe we can work around it to prevent Emacs from
>> crashing?
>
> Absolutely.
>
>>> Happens in emacs -Q (after loading some simple elisp code that uses treesit.el) and consistently and repeatedly.
>>>
>>>
>>> Here's the elisp. When I edebug it I can step and view all the
>>> variables and expressions I like. The `combobulate-' functions are
>>> widely used in the library and pose no issues anywhere else and do
>>> nothing more than fetch nodes via tree sitter. It is only this bit of
>>> code that blows up, and then only when invoked inside a python
>>> string.
>
> It would be nice if you can make a reproduce recipe. Judging from the
> backtrace, you can probably trigger it by printing the node with print
> or princ.  And does it trigger on all python strings? Or some specific
> string in some specific python source?
>

This issue seems entirely related to `M-x treesit-explore-mode` (and possibly the inspect variant also)  though it is hard to reproduce reliably. I get either crashes or hangs, depending on whether I have edebug on or not.

Thrown errors seem to be the common denominator?

> Yuan