unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: felix.dick@web.de, 70059@debbugs.gnu.org
Subject: bug#70059: 30.0.50; c-ts-mode crashes emacs
Date: Mon, 08 Apr 2024 14:35:58 +0300	[thread overview]
Message-ID: <868r1oytlt.fsf@gnu.org> (raw)
In-Reply-To: <08F912D5-CCC4-42C8-8C27-B1CB2085FEA0@gmail.com> (message from Yuan Fu on Sun, 7 Apr 2024 23:32:01 -0700)

> From: Yuan Fu <casouri@gmail.com>
> Date: Sun, 7 Apr 2024 23:32:01 -0700
> Cc: Felix <felix.dick@web.de>,
>  70059@debbugs.gnu.org
> 
> > On Apr 2, 2024, at 11:34 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > 
> >> I mean tree-sitter (the library) runs in the main thread, if it triggers a segfault, AFAIK Emacs currently can’t really do anything. Is that right Eli?
> > 
> > You are right.  But these crashes seem to be inside GC, which
> > processes our objects, so if tree-sitter somehow causes us to create
> > invalid Lisp objects, it's our fault, at least to some extent.
> 
> If the crash happens in ts_node_delete, ts_parser_delete or ts_tree_delete, would the backtrace record that? (Given that the tree-sitter library probably isn’g compile with symbols.) If the crash happens in those functions I think it’s not our fault.

Even if tree-sitter was not compiled with debug symbols, we'd see the
library name in the backtrace.  Like here:

  #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 ()

As you see, the fact that the crash happened in libc is shown, even
though we have no symbols for libc.

Looking at the two backtraces posted in this bug, I see that each time
the crashes were while processing some char-table.  I don't think
treesit-related code manipulates char-table's, does it?  So I don't
think treesit-related code is to blame here, it just so happened that
calling treesit-pattern-expand triggered GC; the invalid object was
probably created by some unrelated code.





  reply	other threads:[~2024-04-08 11:35 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=868r1oytlt.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=70059@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).