unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: vinurs <hi@vinurs.me>
Cc: 73204@debbugs.gnu.org
Subject: bug#73204: Tree-sitter in clojure-ts-mode causes memory leak during parsing
Date: Sat, 14 Sep 2024 00:58:50 -0700	[thread overview]
Message-ID: <1E22209D-FC21-48D8-B9E0-0483E7180B63@gmail.com> (raw)
In-Reply-To: <A8B83941-45D3-4CF4-A0BC-D8BBC2D1F13B@gmail.com>



> On Sep 12, 2024, at 9:24 PM, Yuan Fu <casouri@gmail.com> wrote:
> 
> 
> 
>> On Sep 12, 2024, at 9:21 AM, vinurs <hi@vinurs.me> wrote:
>> 
>> Hi,
>> 
>> I am using the precompiled version from https://emacsformacosx.com/builds 
>> https://emacsformacosx.com/emacs-builds/Emacs-2024-09-11_00-09-10-69e1aca041c57ba425425d31471e1c8f86d3bf04-universal.dmg
>> 
>> I have chosen the latest Emacs 30 version. The min configuration is as follows:
>> 
>> (add-to-list 'treesit-extra-load-path (expand-file-name "tree-sitter/" user-emacs-directory))
>> (add-to-list 'load-path "~/.emacs.d/site-lisp/clojure-ts-mode”) 
>> (require 'clojure-ts-mode) 
>> ;; debug 
>> (setq debug-on-quit t)
>> 
>> and I only use clojure-ts-mode package
>> 
>> cd ~/.emacs.d/site-lisp
>> git clone https://github.com/clojure-emacs/clojure-ts-mode.git
>> 
>> Then, after opening Emacs, 
>> I opened the attached file b.clj, moved to line 57, 
>> and entered the following characters: 
>> (comment
>> 
>> At this point, Emacs freezes and becomes unresponsive. I noticed that Emacs' memory usage keeps increasing:
>> 2024-09-12 21:12:23: 806624 KB
>> 2024-09-12 21:12:28: 810720 KB
>> 2024-09-12 21:12:33: 829840 KB
>> 2024-09-12 21:12:38: 1582256 KB
>> 2024-09-12 21:12:43: 4678816 KB
>> 2024-09-12 21:12:48: 7831776 KB
>> 2024-09-12 21:12:53: 10982384 KB
>> 2024-09-12 21:12:58: 14140048 KB
>> 2024-09-12 21:13:03: 17296176 KB
>> 2024-09-12 21:13:08: 20440960 KB
>> 2024-09-12 21:13:13: 23583008 KB
>> 2024-09-12 21:13:18: 26726272 KB
>> 2024-09-12 21:13:24: 29857312 KB
>> 2024-09-12 21:13:29: 33011456 KB
>> 2024-09-12 21:13:34: 36156624 KB
>> 2024-09-12 21:13:39: 38685440 KB
>> 2024-09-12 21:13:44: 34858560 KB
>> 2024-09-12 21:13:49: 30892768 KB
>> 
>> Then, Emacs eventually gets killed by the system.
>> The bt.log is the information I was able to retrieve
>> ------------
>> Sincerely,<b.clj><bt.log>
> 
> Hi vinurs, 
> 
> Thank you for your detailed report! This looks very similar to bug#72863, which we determined to be a tree-sitter bug. In both that bug and this, ts_parser_parse falls into an inf loop.
> 
> Your test file also uncovered another Emacs bug. I need fix this ASAP (emacs 30 pre-release is already out 😬). Once that’s fixed I’ll check if the hang is due to the same tree-sitter bug.
> 
> Yuan

I fixed the bug I discovered; and guess what, that totally fixed this bug! So this bug isn’t caused by the tree-sitter bug, despite having similar symptoms.

When the next pretest comes out, please give it a try and see if you can still see the bug. Or you can clone the emacs-30 branch and check it out now.

Thanks again for the report! Would’ve been really bad if we didn’t discover this bug before releasing Emacs 30.

Yuan






  reply	other threads:[~2024-09-14  7:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 16:21 bug#73204: Tree-sitter in clojure-ts-mode causes memory leak during parsing vinurs
2024-09-13  4:24 ` Yuan Fu
2024-09-14  7:58   ` Yuan Fu [this message]
2024-09-14  9:14     ` vinurs
2024-09-28  8:51       ` Eli Zaretskii

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=1E22209D-FC21-48D8-B9E0-0483E7180B63@gmail.com \
    --to=casouri@gmail.com \
    --cc=73204@debbugs.gnu.org \
    --cc=hi@vinurs.me \
    /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).