all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Felix via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 70059@debbugs.gnu.org
Subject: bug#70059: 30.0.50; c-ts-mode crashes emacs
Date: Sun, 31 Mar 2024 10:09:33 +0200	[thread overview]
Message-ID: <87a5mex1oi.fsf@web.de> (raw)
In-Reply-To: <92195FEF-E940-41F7-B1A8-EC1607D9473E@gmail.com> (Yuan Fu's message of "Sat, 30 Mar 2024 22:52:55 -0700")

Yuan Fu <casouri@gmail.com> writes:

>> On Mar 29, 2024, at 5:08 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>
>>> From: Felix <felix.dick@web.de>
>>> Cc: Yuan Fu <casouri@gmail.com>,  70059@debbugs.gnu.org
>>> Date: Fri, 29 Mar 2024 12:37:03 +0100
>>>
>>> Eli Zaretskii <eliz@gnu.org> writes:
>>>
>>>>> From: Felix <felix.dick@web.de>
>>>>> Cc: Andrea Corallo <acorallo@gnu.org>,  70059@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’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)”.
>
> 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.
>
> Also, I couldn’t reproduce with upstream tree-sitter plus emacs master
> either. I’m 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, cairo 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.





  parent reply	other threads:[~2024-03-31  8:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 20:36 bug#70059: 30.0.50; c-ts-mode crashes emacs Felix via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-29  5:39 ` Eli Zaretskii
2024-03-29 10:51   ` Felix via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-29 11:25     ` Eli Zaretskii
2024-03-29 11:37       ` Felix via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-29 12:08         ` Eli Zaretskii
2024-03-31  5:52           ` Yuan Fu
2024-03-31  7:43             ` Eli Zaretskii
2024-04-02 18:20               ` Yuan Fu
2024-03-31  8:09             ` Felix via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-04-02 18:22               ` Yuan Fu
2024-04-02 18:34                 ` Eli Zaretskii
2024-04-08  6:32                   ` Yuan Fu
2024-04-08 11:35                     ` Eli Zaretskii
2024-04-17 13:13                       ` Felix via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-17 13:18                         ` Eli Zaretskii
2024-03-30 14:29         ` Andrea Corallo
2024-03-30 11:26   ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a5mex1oi.fsf@web.de \
    --to=bug-gnu-emacs@gnu.org \
    --cc=70059@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=felix.dick@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.